I have an idle animation script in workspace that loads an animation when their idle. This is the script :
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=954273117' end)
Any idea on whats going wrong? Or how to make that animation stay in the player when the player respawns
game.Players.PlayerAdded:Connect(function(player) -- Use Connect with a capital player.CharacterAdded:Connect(function(Char)-- Connect their character spawning to an event repeat wait() until Char:FindFirstChild('Animate') ~= nil -- The event is fired when the body is spawned, and sometimes the animation script is not in yet. Char.Animate.idle.Animation1.AnimationId = 'http://www.roblox.com/asset/?id=954273117' end) end)
Your script changes the player's idle animation when they join the game, not when they spawn. Simply connect it to the 'CharacterAdded' event. Also, just make sure to use 'Connect' instead of 'connect'! Have a good day.