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

How can i make this script find player in the workspace after respawn?

Asked by 7 years ago
1game.Players.PlayerAdded:connect(function(PlayersName)
2        game.Workspace:WaitForChild(tostring(PlayersName)):WaitForChild("Humanoid").Name = "NHumanoid"
3        game.Workspace:WaitForChild(tostring(PlayersName)):WaitForChild("NHumanoid").WalkSpeed = 8
4        game.Workspace:WaitForChild(tostring(PlayersName)):WaitForChild("NHumanoid").JumpPower = 8
5end)

I want to know, how can i make this script find player in workspace after the player respawns? (The script is not local and FE is disabled)

1 answer

Log in to vote
1
Answered by 7 years ago

You would use the CharacterAdded event which passes the player model when they spawn / respawn. There is also an event for when the character loads its appearance CharacterAppearanceLoaded

Example:-

01game.Players.PlayerAdded:connect(function(plr)
02    plr.CharacterAdded:connect(function(charModel)
03        -- change the characters model
04 
05        local humanoid = charModel:WaitForChild('Humanoid')
06        humanoid.WalkSpeed = 8
07        humanoid.JumpPower = 8
08        humanoid.Name = 'NHumanoid'
09    end)
10end)

I hope this helps.

Ad

Answer this question