I'm making a Spleef game, and obviously I'm trying to get a hold of a RANDOM part each second so I can make it "disappear". The problems are: I'm pretty sure when you make a math.random object a local variable, It keeps that part and doesn't reference any other part BUT I have named all of the parts the same name, so I don't know if that will change anything.
while true do local part = math.random(1, #SpleefParts:GetChildren()) part.Transparency = 1 part.CanCollide = false wait(1) end
Pretty straightforward. Anybody?
On your script, the variable part
will just be a number, so this is how to pick a random instance.
while true do local part = SpleefParts:GetChildren()[math.random(1, #SpleefParts:GetChildren())] part.Transparency = 1 part.CanCollide = false wait(1) end