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

Why animations reset after respawn?

I use roblox script to change the anims and so I want to change idle one. It works but after respawn anims break and they don't work.

This one is suggested by someone but doesn't work.

game.Workspace.ChildAdded:connect(function(player)
if Workspace[player.Name]:findFirstChild("Humanoid") ~= nil then
while not game.Players[player.Name].Character do
wait()
end
end

local character = Workspace[player.Name]
local animateScript = character.Animate
animateScript.idle.Animation1.AnimationId = "http://www.roblox.com/asset/?id=80980242"
end)

And the ROBLOX one:

Game.Players.PlayerAdded:connect(function(player)
	while not player.Character do wait() end
	local character = player.Character
	local animateScript = character.Animate
	animateScript.idle.Animation1.AnimationId = 'http://www.roblox.com/asset/?id=80980242'
end)

Please help been trying to solve this for 3 days!

1 answer

This puts it in when the play enters, but not when they respawn. You need to use the CharacterAdded event.

game.Players.PlayerAdded:connect(function(plr)
	plr.CharacterAdded:connect(function(chr)
		--code
	end)
end)

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