Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Char animation doesn't work outside of studio?

Asked by 4 years ago

It's a script inside of a zombie along with an animation. Theoretically, it should simply play the animation (as it does in studio). When I view it from the actual game, however, nothing happens.

local hum = script.Parent.Humanoid

local anim = hum:LoadAnimation(script.Parent.dance)

anim:Play()

Why is it that scripts don't work in the game when they work just fine in studio? This isn't the first one I've had issues with.

0
Your script is work fine, maybe you forgot to publish it. After that, check it again. Block_manvn 395 — 4y
0
That's what I thought too, but I double checked and it is indeed published. AzariahJenkins 0 — 4y

2 answers

Log in to vote
0
Answered by
Xapelize 2658 Moderation Voter Community Moderator
4 years ago

maybe change the first line to this:

local hum = script.Parent:FindFirstChild("Humanoid")

if this works, dont forget to accept the answer

im gtg so if u have comment ill talk to u later

Ad
Log in to vote
0
Answered by 4 years ago

Hello there.

I also have been through this situation too, so I have experience.

I suggest doing this option:

local character = script.Parent
while not character do
    character.AncestryChanged:Wait()
end
local humanoid = script.Parent:WaitForChild('Humanoid')

local anim = humanoid:LoadAnimation(script.Parent.Animation)
anim:Play()

Try checking if your animation is looped, because the game takes time to load your game, and the animation would have already stopped by the time the game loaded.

Answer this question