wait(game.Lighting.TimeToLoad.Value) local UIS = game:GetService("UserInputService") local p = game.Players.LocalPlayer chainnum = 0 chain = "None" chainText = "None" --//Animations local combat1 = script:FindFirstChild("Animations").punchOne local animTrack1 = p.Character.Humanoid:LoadAnimation(combat1) -- local combat2 = script:FindFirstChild("Animations").punchTwo local animTrack2 = p.Character.Humanoid:LoadAnimation(combat2) -- local combat3 = script:FindFirstChild("Animations").punchThree local animTrack3 = p.Character.Humanoid:LoadAnimation(combat3) -- local combat4 = script:FindFirstChild("Animations").punchFour local animTrack4 = p.Character.Humanoid:LoadAnimation(combat4) -- local combat5= script:FindFirstChild("Animations").punchFive local animTrack5 = p.Character.Humanoid:LoadAnimation(combat5) -- local combat6 = script:FindFirstChild("Animations").punchFour local animTrack6 = p.Character.Humanoid:LoadAnimation(combat6) local function Combat(Input, gameProcessedEvent) local KeyCode = Input.UserInputType if KeyCode == Enum.UserInputType.MouseButton1 and script.canAttack.Value == true and chainnum == 0 then chainnum = 1 chainText = p.PlayerGui.PlayerGuis.Menu.mouseLabels.TextLabel.Text p.PlayerGui.PlayerGuis.Menu.mouseLabels.TextLabel.Text = "L" print("1") animTrack1:Play() -- p.PlayerGui.MainGui.Frame["Ki Frame"].Size = p.PlayerGui.MainGui.Frame["Ki Frame"].Size + UDim2.new(.03, 0, 0, 0) wait(0.5) chainnum = 2 else if KeyCode == Enum.UserInputType.MouseButton1 and script.canAttack.Value == true and chainnum == 2 then chainnum = 3 chainText = p.PlayerGui.PlayerGuis.Menu.mouseLabels.TextLabel.Text p.PlayerGui.PlayerGuis.Menu.mouseLabels.TextLabel.Text = "L-L" print("2") animTrack2:Play() -- p.PlayerGui.MainGui.Frame["Ki Frame"].Size = p.PlayerGui.MainGui.Frame["Ki Frame"].Size + UDim2.new(.03, 0, 0, 0) wait(0.5) chainnum = 4 else if KeyCode == Enum.UserInputType.MouseButton1 and script.canAttack.Value == true and chainnum == 4 then chainnum = 5 chainText = p.PlayerGui.PlayerGuis.Menu.mouseLabels.TextLabel.Text p.PlayerGui.PlayerGuis.Menu.mouseLabels.TextLabel.Text = "L-L-L" print("3") animTrack3:Play() -- p.PlayerGui.MainGui.Frame["Ki Frame"].Size = p.PlayerGui.MainGui.Frame["Ki Frame"].Size + UDim2.new(.03, 0, 0, 0) wait(0.5) chainnum = 6 else if KeyCode == Enum.UserInputType.MouseButton1 and script.canAttack.Value == true and chainnum == 6 then chainnum = 7 chainText = p.PlayerGui.PlayerGuis.Menu.mouseLabels.TextLabel.Text p.PlayerGui.PlayerGuis.Menu.mouseLabels.TextLabel.Text = "L-L-L-L" print("4") animTrack4:Play() -- p.PlayerGui.MainGui.Frame["Ki Frame"].Size = p.PlayerGui.MainGui.Frame["Ki Frame"].Size + UDim2.new(.03, 0, 0, 0) wait(0.5) chainnum = 8 else if KeyCode == Enum.UserInputType.MouseButton1 and script.canAttack.Value == true and chainnum == 8 then chainnum = 7 chainText = p.PlayerGui.PlayerGuis.Menu.mouseLabels.TextLabel.Text p.PlayerGui.PlayerGuis.Menu.mouseLabels.TextLabel.Text = "L-L-L-L-L" print("5") animTrack5:Play() -- p.PlayerGui.MainGui.Frame["Ki Frame"].Size = p.PlayerGui.MainGui.Frame["Ki Frame"].Size + UDim2.new(.03, 0, 0, 0) wait(0.5) chainnum = 9 else if KeyCode == Enum.UserInputType.MouseButton1 and script.canAttack.Value == true and chainnum == 9 then chainnum = 10 chainText = p.PlayerGui.PlayerGuis.Menu.mouseLabels.TextLabel.Text p.PlayerGui.PlayerGuis.Menu.mouseLabels.TextLabel.Text = "L-L-L-L-L-L" p.PlayerGui.PlayerGuis.Menu.mouseLabels.TextLabel.TextColor3 = Color3.new(0, 255, 0) print("6") animTrack6:Play() -- p.PlayerGui.MainGui.Frame["Ki Frame"].Size = p.PlayerGui.MainGui.Frame["Ki Frame"].Size + UDim2.new(.03, 0, 0, 0) wait(0.5) chainnum = 0 p.PlayerGui.PlayerGuis.Menu.mouseLabels.TextLabel.Text = "None" p.PlayerGui.PlayerGuis.Menu.mouseLabels.TextLabel.TextColor3 = Color3.new(255, 255, 0) end end end end end end end local oldtext = chainText while wait(1) do if p.PlayerGui.PlayerGuis.Menu.mouseLabels.TextLabel.Text == oldtext and chainnum > 0 then p.PlayerGui.PlayerGuis.Menu.mouseLabels.TextLabel.Text = 'None' --this would technically be none since it's empty chainnum = 0 else oldtext = p.PlayerGui.PlayerGuis.Menu.mouseLabels.TextLabel.Text end end UIS.InputBegan:Connect(Combat)
The while wait(1) do part is where the problem occurs. Any help?
Change your while loop to this:
while true do if p.PlayerGui.PlayerGuis.Menu.mouseLabels.TextLabel.Text == oldtext and chainnum > 0 then p.PlayerGui.PlayerGuis.Menu.mouseLabels.TextLabel.Text = 'None' --this would technically be none since it's empty chainnum = 0 else oldtext = p.PlayerGui.PlayerGuis.Menu.mouseLabels.TextLabel.Text end wait(1) end