UPDATE! I figured out what was wrong. here's the code if anyone wants to borrow it.
-- Made by wookey12 :)
--[[Warning this script only PRINTS the Stamina amount in the output (just for the newbies)
]]
wait(1)
local player = game.Players.LocalPlayer
local mouse = game.Players.LocalPlayer:GetMouse()
local KEYRELEASED = true
mouse.KeyDown:connect(function(KeyDown)
if KeyDown:byte() == 48 then
KEYRELEASED = false
game.Players.LocalPlayer.Character.Humanoid.WalkSpeed = 30
for i = game.Workspace.StaminaVal.Value,1,-1 do
print(i)
game.Workspace.StaminaVal.Value = game.Workspace.StaminaVal.Value - 1
wait(.5)
if i == 1 then
game.Players.LocalPlayer.Character.Humanoid.WalkSpeed = 16
end
if KEYRELEASED == true then
break
end
end
end
end)
mouse.KeyUp:connect(function(KeyUp)
if KeyUp:byte() == 48 then
KEYRELEASED = true
if KEYRELEASED == true then
player.Character.Humanoid.WalkSpeed = 16
for i = game.Workspace.StaminaVal.Value,30,1 do
print(i)
game.Workspace.StaminaVal.Value = game.Workspace.StaminaVal.Value + 1
wait(.5)
if KEYRELEASED == false then
break
end
end
end
end
end)

2 comments
sorry, it doesn't work... i updated my script, maybe it will be simpler to work with?
never mind i figured it out. I posted it in the answers if you want to see what i did.