Animation script broken but working?

So I’m trying to make animations for Seat parts, and while it does work, it doesn’t how I want it to. I was following along to a tutorial off Youtube, on how to make seat animations, but now that I’ve done the seat, script and animation, I’ve combined it, and while it does play a sitting animation when you sit, it doesn’t play it properly. I’ve looked on the Roblox website, and the animation is fine, but in studio it doesn’t play how it should. Here is what it’s meant to look like:


But this is what I have:


I think it might be the script because it shows something is wrong with the red underline, but if the script was broken, then how is the animation working and broken instead of playing the default sitting animation. I have tried fixing it but I don’t know how to script, I have tried re-linking the asset ID, deleting the animation, changing the animation and multiple testings. But it still plays the same animation.

If you want a look a the script, here it is, and any support and help is highly appreciated.

3 Likes

That red line is because you didn’t use local, however, it’s not the problem. Maybe you forgot to add the character’s right and left arm when you created the animation.

3 Likes

I’m going to fix the first issue in a second, but if your second point is invalid. The legs and torso are positioned differently in the broken animation compared to the intended animation as the intended animation’s torso is more angled back and the legs are more angled and spread apart.

2 Likes

You might need to set the priority of the animation to Action4

1 Like

I changed it to action 4 and it didn’t work. I did re-link the asset ID and re-open Roblox Studio but it didn’t change, but I will try with idle priority though.

Yep idle priority didn’t work.

I’m not sure, but try to load it on the humanoid’s animator

anim = human.Animator:LoadAnimation(seat.sitanim)
3 Likes

Nothing changed, I think I might check Youtube or Roblox Documentation for another seat animation tutorial though.

1 Like
local seat = script.Parent
local animation = seat.sitanim
local track = nil

seat:GetPropertyChangedSignal("Occupant"):Connect(function()
    if seat.Occupant == nil then
       if track then track = nil return end
    end
    local humanoid = seat.Occupant
    track = humanoid:LoadAnimation(animation)
    track:Play()
end)
1 Like

I’m not sure if this was for this whole script but when I used your code for the entire script, it just played the default R6 sit animation.

1 Like

I was struggling a lot but after more fidgeting I imported the broken animation, changed it to action 4, and exported as a new animation. It turns out it worked and you were right, so for that I thank you.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.