Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Why my animation not playing while sitting ?

I created this script to play an animation while seating but it doesnt work , it work with an ordinary roblox animation but when i use mine it doesnt work ... I already choose all stage of permission but it doesnt work .

Here the sript:

local seat = script.Parent

  

function SeatIsSatIn(hit)

if hit.Parent:FindFirstChild("Humanoid") then

local character = hit.Parent

local humanoid = character.Humanoid

wait(0.5)

if humanoid:GetState() == Enum.HumanoidStateType.Seated then

local animation = Instance.new("Animation")

animation.AnimationId = "rbxassetid://3160530487"

local track = humanoid:LoadAnimation(animation)

track:Play()

  

local function StateChanged(oldState, newState)

if newState ~= Enum.HumanoidStateType.Seated then

track:Stop()

end

end

  

humanoid.StateChanged:connect(StateChanged)

end

end

end

  

seat.Touched:connect(SeatIsSatIn)

1 comment

0

Try using humanoid.Seated:Connect(function()

1 answer

It could be that the priority of the animation isnt right, like with the animation editor you can change the priority of animations (Meaning if they overlap another animation, say if i was running but i want to have an animation ontop while im holding something, you would change the priority to movement or action)

This discussion is preserved as it was. New answers, comments, and votes are closed.