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

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

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)

1 comment

0

my brain is small btw

1 answer

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

3 comments

0

thank you

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?

0

try now

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