I want to create a sitting animation, where it also plays an animation when you get up and sit down. I’m not sure how to script this, at the moment I have an animation playing just for the sit. How would I script/fix this?
2 Likes
Try this:
anim:Play() --Sitdown
anim.Stopped:wait()
anim:Play() --sitanim
1 Like
It worked, thanks for responding. (not really)
I belive this is a problem with my animation, but apparently after getting up the character continues to play “sitanim.” My animation is looped already, so is there a way to stop the animation from being looped after getting up? (Here’s an exmaple of what happens):
It is possible, you’d need to listen for the character’s humanoid’s “.Seated” event and determine if they started sitting/stopped sitting, then you’d just need to stop & start whatever animations necessary, here’s an example snippet.
local character = script.Parent
local humanoid = character:WaitForChild("Humanoid")
local sitAnimation = script:WaitForChild("Animation")
local sitTrack = humanoid:LoadAnimation(sitAnimation)
humanoid.Seated:Connect(function(isSeated, seatPart)
if isSeated then
sitTrack:Play()
else
sitTrack:Stop()
end
end)
Hopefully this should be simple enough to follow.
1 Like