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

Im trying to make a Disco Floor script?

Im working on a night club and Im always seeing these games with those fancy, detailed coded ones that have like different movements and stuff. Ive been trying to research how to do it but Im still a beginner coder. Any ideas?

1 comment

0

I think you should learn more scripting that is your level before moving to such a level....

2 answers

Do note that this is not a requesting site, but we can show you through on how to accomplish this. First we want to start this with a loop, in this circumstance, we'll use a while loop, this loop continues looping until it's condition is nil or changed.

while condition do

while loop.

A while loop does come with some responsibilities, and consequences. First, lag. A while loop can accumulate some lag in your game if not using FE. Second, crashes. Loops can cause crashes, especially while loops, if not used without a wait() function.

while true do
wait(.5)
end

Finale

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

Specialty

If you want to prevent huge lag( or copying one script at a time), I suggest using a generic loop with for as it's iterator, and a function to receive the values, pairs().

local danceparts=model:GetChildren()

while true do
for index, value in pairs(danceparts) do
value.BrickColor = value.BrickColor.Random()
wait(.5)
end
end

I modified some code for you, Enjoy!

-- Put this in the brick you want to switch colors!

while true do 
script.Parent.Color = Color3.new(math.random(), math.random(), math.random()) 
wait(2.0) 
end 

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