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

Is it possible to get a player from a remote event?

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.)

1 comment

0

Well no, ahhh I'm joking the player is always the first parameter no matter what so the answer is yes

1 answer

✓ Accepted answer

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

5 comments

0

Thanks for the answer :D.

0

You are welcome :)

1

clients cant access anything in server script service or server storage, so having a remote event there is useless.

0

Oh yeah you are right.. Thank you

0

oh ok

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