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

can someone figure out why it picks one insted of randomizing each time you sit down?

Asked by 4 years ago

so i found a script here for sitting animations and it worked exsept for one thing... it doesent randomis it picks one of the 10 animations and thats the only one the server gets. how do i fix this?

script

local sitAnims = {5796017838, 5795997473, 5797358565, 5797367074, 5797454322, 5797437258, 5797418299, 5797400225, 5797394915, 5795997473,} --Paste the same one in twice, unless you want random ones

local seat = script.Parent --Link this to the seat local playingAnim

local newAnim = Instance.new('Animation') newAnim.AnimationId = 'rbxassetid://'..sitAnims[math.random(#sitAnims)]

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

(script by s_iara)

0
my brain is small btw steel_apples 58 — 4y

1 answer

Log in to vote
0
Answered by 4 years ago
Edited 4 years ago
seat.Changed:Connect(function(p)
    if Seat.Occupant ~= nil then
        newAnim.AnimationId = 'rbxassetid://'..sitAnims[math.random(1,#sitAnims)]
    end
end)

Edited as you like. Didn't tested, should work

0
thank you steel_apples 58 — 4y
0
so it now picks a animation per spot itch is fine thank you but is there any way to make it evry time you sit on it it changes? steel_apples 58 — 4y
0
try now SuAkihiro 94 — 4y
Ad

Answer this question