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

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

Asked by 5 years ago

Okay, hears the script from the game.

script.Parent.BrickColor=BrickColor.Random()
wait(1)
end
0
did you put this in a loop? it seems like youre missing a section of your code... SerpentineKing 3885 — 5y
0
Maybe not. charlesec 36 — 5y
0
why is there a random end at the bottom even tho its not in a visible loop? LoganboyInCO 150 — 5y
0
This should be pretty easy to s sngnn 274 — 5y

1 answer

Log in to vote
0
Answered by
royaltoe 5144 Moderation Voter Community Moderator
5 years ago

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
Ad

Answer this question