Animation Script Update Problems

I reposted this because it has been days and nobody has answered. Please answer if you can!

This is sort of two questions in one. So I have a problem with animation in my game, any script that makes an animation play will work when I am testing the game in Roblox Studio. The two things in my game that should be running animations is a seat (makes your sit position different) and an NPC with an animation. Like I said, both of these work when I test my game inside of Roblox Studio. But when I publish my game and actually play it from the website, the NPC is standing in his default position and the seat animations are returned to default. I know I am updating my game correctly because I inserted a part, updated it again, and played it. When I played the part was there. I do not know what is wrong with my scripts at all, what is going wrong in them? Thanks in advance! :smiley:

(NOTE: I am using the Moon Animator Plugin, not sure if that makes any difference.)

I forgot to clarify :sweat_smile:, the NPC is the guy in the gaming chair behind the counter.

Code for the seat:
seat = script.Parent
function added(child)
if (child.className==“Weld”) then
human = child.part1.Parent:FindFirstChild(“Humanoid”)
if human ~= nil then
anim = human:LoadAnimation(seat.sitanim)
anim:Play()
end
end
end

function removed(child2)
if anim ~= nil then
anim:Stop()
anim:Remove()
end
end

seat.ChildAdded:connect(added)
seat.ChildRemoved:connect(removed)

Code for the NPC:
local animation = script:WaitForChild(‘Animation’)

local humanoid = script.Parent:WaitForChild(‘Humanoid’)

local dance = humanoid:LoadAnimation(animation)

dance:Play()

Seat and NPC in Roblox Studio while testing:

Seat and NPC while in the real game after publishing:

I’m not sure if this will fix your problem, but loading animations with the humanoid is deprecated. Instead, do

local anim = human:WaitForChild("Animator"):LoadAnimation(seat.sitanim)

Other than that, I’m not sure. Let me know if this fixes it.

Edit: Also, I know this is probably obvious, but make sure you set the priority to action within the animation editor.

1 Like