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

How to have different sitting animations?

Asked by 5 years ago

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

01local Chair = script.Parent
02local AnimationIsPlaying
03 
04Assets = {4295096597,4292616679}
05for _, asset in ipairs(Assets) do
06game:GetService("ContentProvider"):Preload("http://www.roblox.com/asset/?id=" .. asset)
07end
08 
09local newAnim = Instance.new('Animation')
10newAnim.AnimationId = "rbxassetid://" ..Assets[math.random(1,#Assets)]
11 
12Chair.Changed:Connect(function(property)
13    if property == 'Occupant' then
14        local occupant = Chair.Occupant
15        if not occupant then if AnimationIsPlaying then AnimationIsPlaying:Stop() return end end
16        AnimationIsPlaying = occupant:LoadAnimation(newAnim)
17        AnimationIsPlaying:Play()
18    end
19end)
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. moo1210 587 — 5y
0
oh. I thought something was blocking it from having the other animations not working. TheBuliderMC 84 — 5y

1 answer

Log in to vote
0
Answered by 5 years ago

"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

Ad

Answer this question