Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

What is this line in parentheses do when a remote event is fired?

Asked by 3 years ago

I'm very confused, I saw this in a script I'm looking in and I want to know what it does and how the remote event script knows what it does. Any clarification would be appreciated, thanks! This is the code by the way.

local Event = Instance.new("RemoteEvent")
Event:FireServer("Potato")

Basically I want to know how "Potato" (or the words put in the parentheses after FireServer) could affect or change the fired event. Thank you all so much!

1 answer

Log in to vote
1
Answered by
zane21225 243 Moderation Voter
3 years ago

The parenthesis is used to transfer information from one side of the event to another.

For example:

script 1 (fires the event)

local Event = game.ServerStorage:WaitForChild('RemoteEvent')

Event:FireServer('Hello!')

script 2 (receives the event)

script.Parent.OnServerEvent:Connect(function(text) --the "Hello!" string that we sent over, put into a variable
wait(3)
print(text)
end)
1
THIS HELPED ME SO MUCH THANK YOU! JadensLua 12 — 3y
0
You're welcome! zane21225 243 — 3y
Ad

Answer this question