[SOLVED BY MYSELF]
I want this script to detect when a player is moving, and give speed if they are. It was working at one point, and still is, just not all the time.
What I mean by this, is if my speed suddenly changes, it'll detect me moving, but if I'm moving at a relatively constant speed, it doesn't.
I've tried a lot of different things, and nothing is working. Here is the code, any help is appreciated.
game.Players.PlayerAdded:Connect(function(player)
player:WaitForChild("leaderstats"):WaitForChild("Cardio")
local Debounce = false
local Speed = player.Speed
local TotalSpeed = player.TotalSpeed
local Cardio = player.leaderstats.Cardio
local TotalCardio = player.TotalCardio
local SpeedMulti = player.SpeedMulti
local Char = game.Workspace:WaitForChild(player.Name)
while true do
Char.Humanoid.Running:Connect(function(speed)
if Debounce == false and speed > 0 then
print(speed)
Debounce = true
Speed.Value = Speed.Value + 1 * SpeedMulti.Value
TotalSpeed.Value = TotalSpeed.Value + 1 * SpeedMulti.Value
Cardio.Value = Cardio.Value + 1 * SpeedMulti.Value
TotalCardio.Value = TotalCardio.Value + 1 * SpeedMulti.Value
end
end)
wait(1)
Debounce = false
end
end)
Edit: The print(speed) also doesn't print.
