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

Animation script works in studio but not game. Why?

Hello! I've been trying these scripts with my animation and neither of them work.

The first one is in ServerScriptService and is a normal script. The other is in a block. The second one is there because I can't seem to figure out how to make the animation come back once the player dies. The script is also a normal script Can you please help me?

I've tried everywhere with the below script.

I've tried making a humanoid.Died script and putting it into the startergui/starterpack/serverscriptservice and neither one of them worked. Attempting scripts and localscripts.

It doesn't provide any errors because it works in studio. But not in game. So I'm quite stuck.


	game.Players.PlayerAdded:connect(function(player)
	    player.CharacterAdded:connect(function(character)
	        local findanimate = character:FindFirstChild("Animate")
	        findanimate:WaitForChild("walk"):WaitForChild("WalkAnim").AnimationId = 'http://www.roblox.com/asset/?id=294556403'

	        wait(1)
	    end)
	end)

1 answer

Problem

The only problem I can see is that since it works in studio and not in server it should be a latency problem, this happens because in studio everything is pretty much local so you don't have to wait for a server to create stuff so your local scripts run instantly. In server this doesn't happen as when a local scripts cause upons something in player or character that is server-sided then the local script is "local" which makes it run faster then the server can respond.

Solution

repeat wait() until game.Players.LocalPlayer.Character--To the top of every local script

2 comments

0

Where do I put the script

0

editted

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