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

A disco floor script that i used will not work, any help?

Okay, hears the script from the game.

script.Parent.BrickColor=BrickColor.Random()
wait(1)
end

4 comments

0

did you put this in a loop? it seems like youre missing a section of your code...

0

Maybe not.

0

why is there a random end at the bottom even tho its not in a visible loop?

0

This should be pretty easy to s

1 answer

✓ Accepted answer

your current script will only run once changing the brick color. you could do this to make the brick (the parent) change color indefinitely:

while(wait(1))do
       script.Parent.BrickColor=BrickColor.Random()
end

This will work, but you will have to have the script inside each one of the bricks.

You can instead have one script for all your parts in your disco floor. Do this by grouping all the parts together and putting this script inside the model:

--get all the children of the model
children = script.Parent:GetChildren()

--changes all the parts brick color to a random part every second
while(wait(1))do
        --look through all the children inside the model
        for i, child in ipairs(children) do
                --check if child is a part
                if(child:IsA("BasePart"))then
                        --change color
                        brick.BrickColor=BrickColor.Random()
                end
        end
end

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