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

Is there any other way to define a player using a server script?

Asked by 6 years ago
Edited 6 years ago

I know there is:

game.Players.PlayerAdded:Connect(function(plr)

but I need a command that would run every time (like when a player dies, etc) not just when the player joins. Is there anything else that can define a player like how in a local script:

game.Players.LocalPlayer
0
No, and I don't think you should be trying this. Use a local script. T0XN 276 — 6y
0
what command do you need specifically? creeperhunter76 554 — 6y

3 answers

Log in to vote
2
Answered by 6 years ago

No. Scripts cannot read your mind. The script doesnt know which player to pick. The script is like "uhh should i pick InfernoExecutioner or like that guest over there? dunno.". If scripts could read your mind, scripting would be much easier.

Ad
Log in to vote
0
Answered by
Asceylos 562 Moderation Voter
6 years ago
game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(character) -- fires everytime a player respawns
print(player.Name)
end)
end)
Log in to vote
0
Answered by 6 years ago

You can move the main script or whatever script your working with into StarterCharacter.

Now inside the script you can find the player like this:

game.Players:FindFirstChild(script.Parent.Name)

What that does is it finds the Parents name (Which is the players name) in Players

I hope this helped

Answer this question