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
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.
game.Players.PlayerAdded:Connect(function(player) player.CharacterAdded:Connect(function(character) -- fires everytime a player respawns print(player.Name) end) end)
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