Greetings fellow humans,
I am here to ask if its possible to get a player from a remote event. (which you can tell from the title)
I have put the following localscript inside of a text button:
script.Parent.MouseButton1Click:Connect(function() game.ServerScriptService.StarterEvents.Player:FireServer() end)
And the following script inside of ServerScriptStorage:
script.Parent.OnServerEvent:Connect(function(player) if player.Name == "xTriton" then print'cool' end end)
Can a player pass through a parameter using remote events or do i need a remote function for that?
(in case your wondering i started using remote events yesterday so cut me some slack.)
EDIT: theking48989987 is right, nothing can be accessed in ServerScriptService, so put the RemoteEvent to e.g Replicated Storage
When you Fire a RemoteEvent, the first argument automatically will be the player. So if game.ServerScriptService.StarterEvents.Player
is a RemoteEvent, your localscript is correct, and your script in serverscriptservice.. script.Parent
(if your script's parent is really Server Script Service) is SSS. Use your remoteevent's name, as in the localscript: game.ServerScriptService.StarterEvents.Player.OnServerEvent ...
Change this one thing and it will work