local seat = script.Parent
local playingAnim
local newAnim = Instance.new('Animation')
newAnim.AnimationId = 'rbxassetid://'..sitAnims[math.random(#sitAnims)]
seat.Changed:Connect(function(property)
if property == 'Occupant' then print("stop")
local occupant = seat.Occupant
if not occupant then if playingAnim then playingAnim:Stop() return end end print("run")
playingAnim = occupant:LoadAnimation(newAnim)
playingAnim:Play()
end
end)
You could try calling :GetPlayingAnimationTracks() on the player’s humanoid to stop every playing track when they sit in the chair, and then for your animation, set it’s priority to the highest, ‘Action’ I think it is.
In the math.random try to add one more argument because math.random require 2 argument inside, and don’t forget when you local a sitAnims, add a GetChildren() function in so the math.random can know what it will random. The argument should be 1, the code of the math.random should be like this : newAnim.AnimationId = 'rbxassetid://'..sitAnims[math.random(1, #sitAnims)]
Hope this can help you out!
P/S : Are you Vietnamese? ( Sorry for asking this stupid question. )