“eventos remotos roBlox” Código de respuesta

remotevent roBlox

--Server => Client
remoteEvent:FireAllClients() --Server Script
remoteEvent:FireClient(player) --Server Script
remoteEvent.OnClientEvent:Connect() --Local Script

--Client => Server
remoteEvent:FireServer() --Local Script
remoteEvent.OnServerEvent:Connect() -- Server Script
ClasWasHere

eventos remotos roBlox

-- Example on creating a part. Using Remote Events
-- Client - Server.

-- (Local Script) Fire Remote Event

    local ReplicatedStorage = game:GetService("ReplicatedStorage")
     
    local remoteEvent = ReplicatedStorage:WaitForChild("RemoteEventTest")
     
    -- Fire the remote event
    remoteEvent:FireServer()
    
    -- Include additional data when firing the event
    -- Like passing Color and Position to Server
    
    -- remoteEvent:FireServer(BrickColor.Red(), Vector3.new(0, 25, 0)) --

-- (Script) Create Part on Server
	local ReplicatedStorage = game:GetService("ReplicatedStorage")
     
    --Get removeEvent from the ReplicatedStorage
    local remoteEvent = ReplicatedStorage:WaitForChild("RemoteEventTest")
     
    -- Create a new part
    local function onCreatePart(player, partColor, partPos)
    	print(player.Name .. " fired the remote event")
    	local newPart = Instance.new("Part")
        
        -- Use attributes you passed on
    	newPart.BrickColor = partColor
    	newPart.Position = partPos
    	newPart.Parent = workspace
    end
     
    -- Call "onCreatePart()" when the client fires the remote event
    remoteEvent.OnServerEvent:Connect(onCreatePart)
Adventurous Ant

Respuestas similares a “eventos remotos roBlox”

Preguntas similares a “eventos remotos roBlox”

Más respuestas relacionadas con “eventos remotos roBlox” en TypeScript

Explore las respuestas de código populares por idioma

Explorar otros lenguajes de código