Ok, So I self-debugged it and it does change the value, BUT not the text. It is getting a little annoying so I just came here to ask a question about it.
local plr = game.Players.LocalPlayer
local sp = Instance.new("IntValue")
sp.Value = 100
plr.PlayerGui.MainUI.Display.SprintPower.Text = "Sprint Power: " ..sp.Value
sp.Parent = plr
while true do
wait()
function onKeyPress(inputObject, gameProcessedEvent)
if inputObject.KeyCode == Enum.KeyCode.R then
local character = plr.Character
if character then
local hum = character:WaitForChild"Humanoid"
if hum then
hum.WalkSpeed = 26
end
else
print("no character")
end
sp.Value = 100
wait(1)
sp.Value = 50
wait(10)
sp.Value = 0
if sp.Value == 0 then
plr.Character.Humanoid.WalkSpeed = 16
end
end
end
game:GetService("UserInputService").InputBegan:connect(onKeyPress)
function onKeyPressEnd(inputObject, gameProcessedEvent)
local character = plr.Character
if character then
local hum = character:WaitForChild"Humanoid"
if hum then
hum.WalkSpeed = 16
end
else
print("no character")
end
sp.Value = 50
wait(1)
sp.Value = 100
end
game:GetService("UserInputService").InputEnded:connect(onKeyPressEnd)
end
If anyone knows the error please answer this! :)

1 comment
First off I'd put the "Sprint Power" .. sp.Value in brackets, I don't know if this will change anything but it usually helps in telling the computer what to change the text to. Second, make sure you use a local script when calling on "Local Player", because it will substitute the player for nil unless it's in a local script.