Problem with custom sitting animation

Hi, I am new to the devforum, and i wanted to ask a small question, i am trying to do a custom seat animation transition to another, the animation works, but the thing is, the animation will not stop so i can make it go to another, here is a pic of the code, did i do anything wrong or is it just not possible? image

u are trying to load the animations only if the humanoid isn’t nil. the animation required should be above if e.g:

local animation = "epic"
local loadanimation =  humanoid:LoadAnimation(animation)
if hum ~= then
     loadanimation:Play()
else
      loadanimation:Stop()
      animation:Remove() -- this isn't much needed
end

something like that. please provide the code next time. so people can help you better.

ight sorry i forgot to provide it

probably a bit late now but here you go

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()
		elseif seat.Parent.ff.Value == true then
			anim:Remove()
			anim:Stop()
		end
	 end
end



seat.ChildAdded:connect(added)

Heres your fixed code xd

local anim
local seat = script.Parent
seat.Changed:Connect(function(changed)
	if changed == "Occupant" then
		local human = seat.Occupant
		if human then
			anim = human:LoadAnimation(seat.sitanim)
			anim:Play()
		elseif seat.Parent.ff.Value then
			anim:Stop()
		end
	 end
end)

Hope it works!

hmmm… the animation just… no longer plays… any idea?

thanks for trying to help btw)

Any errors in the output you could send me? Thanks!

nothing in the output, pure clean

Ah, try the new code. I forgot to change the name of an event haha

animation now plays, but when the ff value is set to true, the animation doesn’t stop.

is it something to do with what i set the animation priority to? i believe i set it to action, is that the problem or no?

Use :GetPropertyChangedSignal for the ff.

where about’s should i put that?
image

(srry i’m a little dumb)

local anim
local seat = script.Parent
seat.Changed:Connect(function(changed)
	if changed == "Occupant" then
		local human = seat.Occupant
		if human then
			anim = human:LoadAnimation(seat.sitanim)
			anim:Play()
     seat.Parent.ff:GetPropertyChangedSignal("Value"):Connect(function()
		if seat.Parent.ff.Value then
			anim:Stop()
                     end
                  end)
		end
	 end
end)

Not sure if it works im on my phone right now i didn’t test it.

4 Likes

thank you man! that did actually work

(would their be a way to make it go back once ff value is disabled btw? srry for asking a bit too much, i’m just curious)

No problem!

Also mark Solution to the post that helped you so people won’t bother replying to this topic.

1 Like

Oh nevermind i made it transition to another animation, anyways thank you so much for your help!

1 Like