what could I do so the while loop actually loops through the text and not cause an error?
001 | wait(game.Lighting.TimeToLoad.Value) |
003 | local UIS = game:GetService( "UserInputService" ) |
004 | local p = game.Players.LocalPlayer |
011 | local combat 1 = script:FindFirstChild( "Animations" ).punchOne |
012 | local animTrack 1 = p.Character.Humanoid:LoadAnimation(combat 1 ) |
015 | local animTrack 2 = p.Character.Humanoid:LoadAnimation(combat 2 ) |
018 | local animTrack 3 = p.Character.Humanoid:LoadAnimation(combat 3 ) |
021 | local animTrack 4 = p.Character.Humanoid:LoadAnimation(combat 4 ) |
024 | local animTrack 5 = p.Character.Humanoid:LoadAnimation(combat 5 ) |
027 | local animTrack 6 = p.Character.Humanoid:LoadAnimation(combat 6 ) |
029 | local function Combat(Input, gameProcessedEvent) |
030 | local KeyCode = Input.UserInputType |
032 | if KeyCode = = Enum.UserInputType.MouseButton 1 and script.canAttack.Value = = true and chainnum = = 0 then |
034 | chainText = p.PlayerGui.PlayerGuis.Menu.mouseLabels.TextLabel.Text |
035 | p.PlayerGui.PlayerGuis.Menu.mouseLabels.TextLabel.Text = "L" |
043 | if KeyCode = = Enum.UserInputType.MouseButton 1 and script.canAttack.Value = = true and chainnum = = 2 then |
045 | chainText = p.PlayerGui.PlayerGuis.Menu.mouseLabels.TextLabel.Text |
046 | p.PlayerGui.PlayerGuis.Menu.mouseLabels.TextLabel.Text = "L-L" |
054 | if KeyCode = = Enum.UserInputType.MouseButton 1 and script.canAttack.Value = = true and chainnum = = 4 then |
056 | chainText = p.PlayerGui.PlayerGuis.Menu.mouseLabels.TextLabel.Text |
057 | p.PlayerGui.PlayerGuis.Menu.mouseLabels.TextLabel.Text = "L-L-L" |
065 | if KeyCode = = Enum.UserInputType.MouseButton 1 and script.canAttack.Value = = true and chainnum = = 6 then |
067 | chainText = p.PlayerGui.PlayerGuis.Menu.mouseLabels.TextLabel.Text |
068 | p.PlayerGui.PlayerGuis.Menu.mouseLabels.TextLabel.Text = "L-L-L-L" |
076 | if KeyCode = = Enum.UserInputType.MouseButton 1 and script.canAttack.Value = = true and chainnum = = 8 then |
078 | chainText = p.PlayerGui.PlayerGuis.Menu.mouseLabels.TextLabel.Text |
079 | p.PlayerGui.PlayerGuis.Menu.mouseLabels.TextLabel.Text = "L-L-L-L-L" |
087 | if KeyCode = = Enum.UserInputType.MouseButton 1 and script.canAttack.Value = = true and chainnum = = 9 then |
089 | chainText = p.PlayerGui.PlayerGuis.Menu.mouseLabels.TextLabel.Text |
090 | p.PlayerGui.PlayerGuis.Menu.mouseLabels.TextLabel.Text = "L-L-L-L-L-L" |
091 | p.PlayerGui.PlayerGuis.Menu.mouseLabels.TextLabel.TextColor 3 = Color 3. new( 0 , 255 , 0 ) |
097 | p.PlayerGui.PlayerGuis.Menu.mouseLabels.TextLabel.Text = "None" |
098 | p.PlayerGui.PlayerGuis.Menu.mouseLabels.TextLabel.TextColor 3 = Color 3. new( 255 , 255 , 0 ) |
107 | local oldtext = chainText |
110 | if p.PlayerGui.PlayerGuis.Menu.mouseLabels.TextLabel.Text = = oldtext and chainnum > 0 then |
111 | p.PlayerGui.PlayerGuis.Menu.mouseLabels.TextLabel.Text = 'None' |
114 | oldtext = p.PlayerGui.PlayerGuis.Menu.mouseLabels.TextLabel.Text |
118 | UIS.InputBegan:Connect(Combat) |
The while wait(1) do part is where the problem occurs. Any help?