Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Can someone help me get a better understanding about RemoteEvents?

Hi I am a Roblox dev and I recently I've been learning some advanced and Beginners scripting So I am still kinda on the RemoteEvents and I don't quite understand em can somebody explain it to me better?

2 comments

0

Remote events are the alternative for FE, however if you do not like exploiters that much, you may wanna use something called honeypots. https://devforum.roblox.com/t/how-you-should-secure-your-game-a-beginner-guide-for-secure-networking-and-developing-anticheats/351775 Remote events are something of like doing something on the client to make it appear on the server, or the opposite.

0

Like for an example, Lets say you're using sleitnick's EZ cam shaker port to roblox. the problem is, you can only use it on the client. But lets say you wanted to do it on all clients well thats where remote events come in. you can make a local script of the shake then on a server script you would fire the remote event to all clients or a single client.

1 answer

✓ Accepted answer

RemoteEvents are used to send information from the server to the client, or vise versa. RemoteFunctions do the same thing as remote events, except it allows the sender to wait for a response. Both work pretty similar to how a normal Function would work. I'll provide an example

--Most people create the remote events and functions as they need them via scripts, but for simplicity I will assume you have a folder inside ReplicatedStorage that will store all the remotes.
-- Example, Create a part with a GuiButton

--Inside local script
gui.MouseButton1Down:Connect(function()
	local Color = Color3.fromRGB(255,255,255)
	local Size = Vector3.new(5,5,5)
	local Position = Vector3.new(10,10,10)
	game.ReplicatedStorage.Remotes.CreatePart:FireServer(Color,Size,Position)
end)


-- Inside a server script

local function CreatePart(player,Color,Size,Position) -- Anytime you send info from the client to the server, the first arguement is automatically assigned and it defines the player. That is why when we fire the RemoteEvent, it doesn't list player, but when we listen for it, it asks for it. 
	local part = Instance.new("Part")
	part.Color = Color
	part.Size = Size
	part.Position = Position
	part.Parent = workspace
end
game.ReplicatedStorage.Remotes.CreatePart.OnServerEvent:Connect(CreatePart) -- Listen for the remote to be fired, and when it is run the function named CreatePart

The below link also explains more about it, and how they are used. You can learn a lot from it. https://developer.roblox.com/en-us/articles/Remote-Functions-and-Events

This discussion is preserved as it was. New answers, comments, and votes are closed.