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

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

Asked by 4 years ago

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)
0
A server with multiple playes doesnt have the concept of a localplayer theking48989987 2147 — 4y

1 answer

Log in to vote
0
Answered by 4 years ago

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

Ad

Answer this question