My script is:
local button = script.Parent
script.Parent.MouseButton1Up:connect(function()
if button.Text == ("Run") then
local h = game.Players:FindFirstChild("Humanoid")
button.Text = ("Walk")
h.Walkspeed = 16 * 1.5
elseif button.Text == ("Walk") then
local h = game.Players:FindFirstChild("Humanoid")
button.text = ("Run")
h.Walkspeed = 16
end
end)
The complete output message:
Players.Player.PlayerGui.ScreenGui1.Frame.TextButton.Script:7: attempt to index local 'h' (a nil value) 15:01:54.335 - Stack Begin 15:01:54.337 - Script 'Players.Player.PlayerGui.ScreenGui1.Frame.TextButton.Script', Line 7
