So, to make this simple, this script is like a adding number script, but once it gets to the
break end
then it stops and does the code below. But i have having some problems as once it gets to the
or Charing == false then
It doesnt print the code under below. Is there a simple fix for this?
local Player = game.Players.LocalPlayer local Charge = 0 local Charing = false local UIS = game:GetService("UserInputService") UIS.InputBegan:connect(function(input) if input.KeyCode ~= Enum.KeyCode.H then return end; Charing = true game:GetService("Chat"):Chat(Player.Character.Head, "HERE I GO...") while Charing == true do print(Charge) Charge=Charge+1 if Charge == 120 or Charing == false then print("aaa") game:GetService("Chat"):Chat(Player.Character.Head, "HA!") break end wait() end end) UIS.InputEnded:connect(function(input) if input.KeyCode ~= Enum.KeyCode.H then return end; Charing = false Charge = 0 end)
You could ditch the or
and just use an elseif
statement instead:
local Player = game.Players.LocalPlayer local Charge = 0 local Charing = false local UIS = game:GetService("UserInputService") UIS.InputBegan:connect(function(input) if input.KeyCode ~= Enum.KeyCode.H then return end; Charing = true game:GetService("Chat"):Chat(Player.Character.Head, "HERE I GO...") while Charing == true do print(Charge) Charge=Charge+1 if Charing == false then print("aaa") game:GetService("Chat"):Chat(Player.Character.Head, "HA!") break end elseif Charge == 120 then -- Use elsif print("aaa") game:GetService("Chat"):Chat(Player.Character.Head, "HA!") break end wait() end end) UIS.InputEnded:connect(function(input) if input.KeyCode ~= Enum.KeyCode.H then return end; Charing = false Charge = 0 end)