How would I play an animation when a character sits?

I want to make a game where you play as a person who sits on a computer, but I’m having trouble finding out how to make the seat find out whos sitting on it, and to play an animation when they do.


I know for a fact the animation part of the script works, because I tested it. I just don’t know how to trigger the animation when the character sits down.
image
If someone knows the answer to my issue, it’d be a lot of help and I’d like to give thanks in advance.
Edit: the animation is inside the character, and the server script is in the seat part

2 Likes

You could try detecting if the Seat | Roblox Creator Documentation property changed like this:

script.Parent:GetPropertyChangedSignal("Occupant"):Connect(function()
    -- your code for animating the character
end)

However, the API documentation stated that the property wasn’t replicated across the server/client boundary. In other words, you can try it, but if it doesn’t work than you may need to use a local script instead.

2 Likes

There’s a property in the Humanoid called something like Sit so if that’s true then just play anim (NOTE: I don’t know if sit is the exact name but if it is use this)

humanoid:GetPropertyChangedSignal("Sit"):Connect(function()
   
end)
1 Like

Wow! That was really quick of a fix! Thanks, you helped me out a bunch.
image
God bless you!

1 Like

I’ll give it a go, might be worth some looking into

1 Like