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

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

Asked by 5 years ago

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

0
Well no, ahhh I'm joking the player is always the first parameter no matter what so the answer is yes GameBoyOtaku 63 — 5y

1 answer

Log in to vote
0
Answered by
Miniller 562 Moderation Voter
5 years ago
Edited 5 years ago

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

0
Thanks for the answer :D. sonysunny 36 — 5y
0
You are welcome :) Miniller 562 — 5y
1
clients cant access anything in server script service or server storage, so having a remote event there is useless. theking48989987 2147 — 5y
0
Oh yeah you are right.. Thank you Miniller 562 — 5y
0
oh ok sonysunny 36 — 5y
Ad

Answer this question