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

How can I get the local player in a server script? Is it even possible?

So we have it so it automatically changes your clothing in a script when you enter the game. But its saying I cannot get player. I know I cannot in a server script but how would I do it? ServerScript inside of serverscriptservice:

local status = game.ReplicatedStorage:WaitForChild("Status")
script.Parent.Text = status.Value

status.Changed:Connect(function()

    script.Parent.Text = status.Value

end)

1 comment

0

A server with multiple playes doesnt have the concept of a localplayer

1 answer

Turns out I already figured this out dont worry man.

function onPlayerEntered(newPlayer)
	repeat wait(0.2) until newPlayer.Character
	repeat wait(0.2) until newPlayer.Character.Shirt
	repeat wait(0.2) until newPlayer.Character.Pants
	newPlayer.Character.Shirt.ShirtTemplate = newPlayer.stats.ShirtID.Value
	newPlayer.Character.Pants.PantsTemplate = newPlayer.stats.PantsID.Value
	
end





game.Players.ChildAdded:Connect(onPlayerEntered)

Its more adapted to my game system though and usualy everyones different. Basically when the player joines it uses game.Players.ChildAdded:Connect(onPlayerEntered) it get the player specifically (newPlayer) which newplayer is the player who is selected

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