So, I have a RemoteEvent in ReplicatedStorage, which was created by a serverscript, but I need to get the player's teamcolor. But since I can't use LocalPlayer, is there anyway to declare a localplayer in a serverscript?
✓ ANSWER ACCEPTED
Is there alternative way to a localplayer?
1 answer
✓ Accepted answer
Since the Script belongs to the server, there can't be a local player. But when clients fire remote events. The first argument is the player who fired it. If I understand your question correctly, that should be what you need.
local remote = game:GetService("ReplicatedStorage"):WaitForChild("RemoteEvent")
remote.OnServerEvent:Connect(function(player, otherArguments)
--Works fine
print(player.Name .. " has fired an event!")
end)
This discussion is preserved as it was. New answers, comments, and votes are closed.

1 comment
Is the ServerScript the one that is firing the RemoteEvent, or is it the one that is receiving it from a LocalScript?