Hi guys, I was experimenting with returns and if statements. There is a problem that I have because the if statement isn’t running
local boolean = true
local part = script.Parent
local breakingpoint = 0
local breakingpointaddition = 1
local function randomizer()
adder = breakingpoint + 1
if boolean == true then
print("yay")
while wait(1) do
print(breakingpoint)
if breakingpoint >= 10 then
break
end
part.BrickColor = BrickColor.random()
end
else
print("WHYYY")
return
end
end
print("LETS GOOOO")
and please correct me if I’ve done something wrong in the script
Optional. You can just check if boolean then, because it will automatically check if its not false or not nil (vise-versa (I think its this word?) if you check if not boolean then aka it will check if its true or something else besides false or nil, In other words it will check if its false or nil)
You never add 1 to it (or whatever number you want)
while wait(1) do
print(breakingpoint)
if breakingpoint >= 10 then
break
end
part.BrickColor = BrickColor.random()
end
You never add any number to it there, you can fix it by doing this
while wait(1) do
print(breakingpoint)
if breakingpoint >= 10 then
break
end
part.BrickColor = BrickColor.random()
breakingpoint += 1 -- aka breakingpoint = breakingpoint + 1
end