I’ve already read the topic on RemoteFunctions and RemoteEvents and still don’t understand, so I am creating this post.
We already know that normal functions() can have custom vars. Something like this:
local function printAnything(message)
print(message)
end
printAnything("Custom messages are implemented")
task.wait(1)
printAnything("Another message")
I was wondering if you could add custom vars like the message var inside RemoteFunctions or RemoteEvents so you could make them more customizable. If so, can you please tell me how?
Yep you can. Lets say you want to do something on the server from the client. Youd have something like this then:
RemoteEvent.OnServerEvent:Connect(function(Plr,Arg) -- // The player that fired the remote event is always the first arg
print(Plr,Arg)
end)
RemoteEvent:FireServer("Hello world!")
Also note that you cant pass stuff such as instances as parameters through remotes (