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

How to have different sitting animations?

I had 2 IDs in and yet it's not playing the other one and sticking to one ID only.

local Chair = script.Parent
local AnimationIsPlaying 

Assets = {4295096597,4292616679}
for _, asset in ipairs(Assets) do
game:GetService("ContentProvider"):Preload("http://www.roblox.com/asset/?id=" .. asset)
end

local newAnim = Instance.new('Animation')
newAnim.AnimationId = "rbxassetid://" ..Assets[math.random(1,#Assets)]

Chair.Changed:Connect(function(property)
    if property == 'Occupant' then
        local occupant = Chair.Occupant
        if not occupant then if AnimationIsPlaying then AnimationIsPlaying:Stop() return end end
        AnimationIsPlaying = occupant:LoadAnimation(newAnim)
        AnimationIsPlaying:Play()
    end
end)

2 comments

0

Works fine for me, remember math.random is 100% luck, its rare, but you could still get the same sitting animation 50 times in a row.

0

oh. I thought something was blocking it from having the other animations not working.

1 answer

"Works fine for me, remember math.random is 100% luck, its rare, but you could still get the same sitting animation 50 times in a row." -Moo1210

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