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

Why won't my Animation work more than once?

Hello! I have recently made a falling animation! The script replaces the default animation to the one I made. However it only does this once. Then if I die or reset it goes back to the normal animation. How can I make it so it will change the animation always?

Here is the script, Also I have tried while true do, but that doesn't work.

	game.Players.PlayerAdded:connect(function(player)
	while not player.Character do wait() end
	local character = player.Character
	local animateScript = character.Animate
	animateScript.fall.FallAnim.AnimationId = 'http://www.roblox.com/asset/?id=196505089'
end)

2 answers

✓ Accepted answer

Simply use the character added event which will fire every time a character is "added" to the player, i.e. every time they respawn.

The character added event has 1 built in parameter equal to the character that has just been added.

game.Players.PlayerAdded:connect(function(plr)
	plr.CharacterAdded:connect(function(chr)
		print("A character was added to "..plr.Name)
	end)
end)

1 comment

0

This worked! I had to modify it a little bit but it is now working full time! Thanks!

Instead of doing PlayerAdded, Try this: Add a localscript inside the StarterGui:

while not player.Character do wait() end
local character = player.Character
local animateScript = character.Animate
 animateScript.fall.FallAnim.AnimationId = 'http://www.roblox.com/asset/?id=196505089'

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