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

Having trouble getting a player that made a remote event turn on?

Hello. I'm doing this GUI where you press a button and it sends to a event to go.

It works and all but I was wondering if there was any way to see who did it in the script where it says how the event is run. Here's what I tried so far. (its in a normal script not local script)

local player = game.Players.LocalPlayer

Anim.Engine1FE.OnServerEvent:Connect(function()
	print(player)
end)

Any help?

1 answer

✓ Accepted answer
Anim.Engine1FE.OnServerEvent:Connect(function(player)
    print(player)
end)

Since this is in a server script and not a local one, you can't do game.Players.LocalPlayer. Instead, OnServerEvent has a parameter that tells you who the player is. All you have to do is put in player inside of the function's ().

Hope this helped!

1 comment

0

When you are firing the Event via LcoalScript, you do not have to pass the player through as an argument, as it's already a pre-passed parameter.

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