Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why my animation not playing while sitting ?

Asked by 5 years ago

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)
0
Try using humanoid.Seated:Connect(function() SunxLightz 30 — 5y

1 answer

Log in to vote
0
Answered by 5 years ago

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)

Ad

Answer this question