When size is more then 20 its supposed to print("Over 20") why isn't it working? When it is over 20 it doesnt do anything instead the value of size keeps going.Test it and you will see
player = script.Parent.Parent char = player.Character mouse = player:GetMouse() hold = false function keydown(key) key = key:lower() if key == "z" then hold = true bricksize() end end function bricksize() size = 0 if size > 20 then hold = false print("OVer 20") end while hold == true do wait() size = size+1 print(size) end end function keyup(key) key = key:lower() if key == "z" then hold = false end end if hold == false then size = 0 end mouse.KeyDown:connect(keydown) mouse.KeyUp:connect(keyup)
I changed a bit around the bricksize function, here you go, this should work.
player = script.Parent.Parent char = player.Character mouse = player:GetMouse() hold = false function keydown(key) key = key:lower() if key == "z" then hold = true bricksize() end end function bricksize() size = 0 while hold == true do wait() if size > 20 then hold = false print("OVer 20") else size = size+1 print(size) end end end function keyup(key) key = key:lower() if key == "z" then hold = false end end if hold == false then size = 0 end mouse.KeyDown:connect(keydown) mouse.KeyUp:connect(keyup)