#Why doesn't it work??
38 messages · Page 1 of 1 (latest)
You have to substitute n with a number or make a another variable with the identifier n outside of the while loop and function
like this?
yeah
** You are now Level 1! **
should work
wait why are you creating another local variable loop
inside of the while loop
it is so that the loop isnt infinite
because it ends when the loop variable value is 5
or more
oh wait try instead of Random, math.random()
it still doesnt seem to work
am I trying something too difficult?
no no
give me a second
do you want to keep the transparency when the function is run again?
@grand fulcrum
sure
function ColorRandom(n)
if n == 1 then
workspace.Part.BrickColor = BrickColor.new(math.random(100))
else
workspace.Part.Transparency = 0.75
end
wait(4)
end
local loop = 0
while loop < 5 do
local n = math.random(2)
ColorRandom(n)
loop += 1
end```
that should work
Im confused because it still doesn't, but it looks like it should
is it in a server script? (a normal script)
** You are now Level 2! **
No why?
I put it in a local script
local scripts don't work in the workspace
It doesnt change color, although I like that its transparent
Maybe it was just a luck thing
yeah because of math.random
if you dont want it to be transparent then you can remove the else statement
It worked!
👍