Hi, Is just that I'm making this sprint but something is wrong with the debounce and I don't know how to fix it, everything else is okey since the Output shows no errors.
The idea is for the "Repeat" loop to stop subtracting the value 1 to SoulPoints if the Debounce SF becomes true or if SoulPoints reaches 0, It stops once the value is 0 but not when SF equals true. This might be a total beginner error but please help me.
Player = game.Players.LocalPlayer Mouse = Player:GetMouse() ST = false SF = false function Sprint(key) Key = key:lower() if Key == Skills["Sprint"].HotKey.Text and ST == false and SF == false and SoulPoints.Value >= 1 then ST = true Hum.WalkSpeed = 50 repeat SoulPoints.Value = SoulPoints.Value - 1 wait() until SF == true or SoulPoints.Value == 0 end end function SprintStop(key) Key = key:lower() if Key == Skills["Sprint"].HotKey.Text and ST == true and SF == false then ST = false SF = true Hum.WalkSpeed = 16 end SF = false end Mouse.KeyDown:connect(Sprint) Mouse.KeyUp:connect(SprintStop)
On lines 27-31. Notice how you set SF to true, but not even within a frame, you're setting it back to false. The repeat loop has almost no time to catch the change. Instead of having SF=false
on line 31, put it below line 18.