im pretty new to roblox scripting so sorry if it look at little messy but heres my script where i want a brick to set on fire and a bunch of other stuff if clicked too many times, everything works except the actions for when the script gets to a certain variable
CatAnger = 0 function onClick(click) print(CatAnger) CatAnger = CatAnger + 1 end script.Parent.MouseClick:connect(onClick) while true do wait(0.5) CatAnger = CatAnger - 1 end while true do if CatAnger > 5 then print("DO BEEP BEEP") end wait(1) end function angery() workspace.AngerWall.Fire.Enabled = true workspace.AngerWall.Smoke.Enabled = true workspace.AngerWall.HappytheCat.Transparency = 1 workspace.AngerWall.angrycat.Transparency = 0 workspace.AngerWall.AHHH.Sound:Play() end while true do end if CatAnger < 0 then print("1^") CatAnger = CatAnger + 1 end
this is the entire script and here are my problems
while true do if CatAnger > 5 then print("DO BEEP BEEP") end wait(1) end
(designed to trigger a function when its over 5)
if CatAnger < 0 then print("1^") CatAnger = CatAnger + 1 end
(designed to put it back to 0 when it goes under 0)
i've tried to add while true do loops to always be checking if its over but no luck, i'm sure there's a simple answer, plz help C:
You can make them into a function instead of while wait() do, a while true do will find the nearest 'end' and fire the code that sandwiched inside the while true do, like line 31 - 33, there sandwiched blank, so line 34 - 37 will not work.
I just copied the comment to the answer because this is working soooo
If worked just accept lolz I have already upvoted