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

Im trying to make a Disco Floor script?

Asked by 8 years ago

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?

0
I think you should learn more scripting that is your level before moving to such a level.... KingLoneCat 2642 — 8y

2 answers

Log in to vote
0
Answered by
rexbit 707 Moderation Voter
8 years ago

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
Ad
Log in to vote
-1
Answered by 8 years ago

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 

Answer this question