Reputation: 376
sorry about the vague title, I have no idea on how to explain what I'm trying to do.
I'm trying to replicate a "choosing"(?) effect from a ROBLOX game shown here
I've gotten to basically the exact same thing, except for one problem. It always stops on the same part every time (the top). Posting here is my current last resort (the scripting subforum on roblox is incredibly inactive)
for i = 1, 3 do
for _, ll in pairs(P:GetChildren()) do
lastbcolor = ll.BrickColor
ll.BrickColor = BrickColor.Yellow()
wait(t)
ll.BrickColor = lastbcolor
lastpicked = ll
print(t)
t=t+0.2 -- to slow down
end
end
Upvotes: 0
Views: 109
Reputation: 23737
math.randomseed(os.time())
local t = P:GetChildren()
local N = #t -- number of menu items
local K = 1
for R = 20 + math.random(N), 1, -1 do
ll = t[K]
local lastbcolor = ll.BrickColor
ll.BrickColor = BrickColor.Yellow()
wait( R^-.7*.7 )
ll.BrickColor = lastbcolor
K = K % N + 1
end
ll = t[K]
-- blink
for R = 1, 5 do
local lastbcolor = ll.BrickColor
ll.BrickColor = BrickColor.Yellow()
wait( .3 )
ll.BrickColor = lastbcolor
wait( .3 )
end
Upvotes: 1