Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

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

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

✓ Accepted answer

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.

This discussion is preserved as it was. New answers, comments, and votes are closed.