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 6 years ago
game.Players.PlayerAdded:connect(function(PlayersName)
        game.Workspace:WaitForChild(tostring(PlayersName)):WaitForChild("Humanoid").Name = "NHumanoid"
        game.Workspace:WaitForChild(tostring(PlayersName)):WaitForChild("NHumanoid").WalkSpeed = 8
        game.Workspace:WaitForChild(tostring(PlayersName)):WaitForChild("NHumanoid").JumpPower = 8
end)

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 6 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:-

game.Players.PlayerAdded:connect(function(plr)
    plr.CharacterAdded:connect(function(charModel)
        -- change the characters model

        local humanoid = charModel:WaitForChild('Humanoid')
        humanoid.WalkSpeed = 8
        humanoid.JumpPower = 8
        humanoid.Name = 'NHumanoid'
    end)
end)

I hope this helps.

Ad

Answer this question