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)

1 comment
Yes, Thank you so much, it worked.