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

How can I receive the info carried with the remote event on the other end?

Asked by 3 years ago
Edited 3 years ago

This is the specific line I'm talking about:

PunchHit:FireServer(hit.Parent, dmg)

This remote event is supposed to be going from client to server, so I'm firing the event so the server can damage that player for everybody (this is for a punch script). The problem is, I know how to detect a remote event fire from another script but I don't know how to receive that specific additional information so it can be used. How exactly would I do this? Thank you so much.

1 answer

Log in to vote
0
Answered by 3 years ago

You use parameters, the first parameters for OnServerEvent is always the player

So RemoteEvent.OnServerEvent:Connect(function(player,hit.parent,Dmg)

end)

With FireServer the first parameter is always player, put the parameters you want 2nd first. Also when receiving parameters they don’t need to have same name. You could have RemoteEvent.OnServerEvent:Connect(function(player,hit.parent,Dmg) print(player) print(hit.Parent) print(Dmg) end) And RemoteEvent.OnServerEvent:Connect(function(playaaaa,bananas,UrMoooom) Print(playaaaa) print(bananas) print(UrMoooom) end)

And they would print exact same thing. Sorry for bad grammar on mobile

Ad

Answer this question