Walkspeed not changing when i want it to

when i reset the walkspeed changes butt… when i wanna change the walkspeed it doesnt do noTHING

THE SCRIPT:
local player = game.Players.LocalPlayer

local char = player.Character or player.CharacterAdded:Wait()

local h = char.Humanoid
TexasButton.MouseButton1Click:Connect(function()

if tonumber(TextBox.Text)<100 then
	h.WalkSpeed = tonumber(TextBox.Text)
else
	h.WalkSpeed = 16


end 

end)

local myspeedbeforedeath
player.Character:WaitForChild(“Humanoid”).Died:Connect(function()

myspeedbeforedeath = player.Character.Humanoid.WalkSpeed

end)

player.CharacterAdded:Connect(function()

player.Character:WaitForChild("Humanoid").WalkSpeed = myspeedbeforedeath

end)

function onKeyPress(inputObject, gameProcessedEvent)
if inputObject.KeyCode == Enum.KeyCode.RightControl then
if Frame.Visible == false then
Frame.Visible = true
else
Frame.Visible = false
end
end
end

game:GetService(“UserInputService”).InputBegan:connect(onKeyPress)

local userInput = game:GetService("UserInputService")
local players = game:GetService("Players")
local player = players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local humanoid = character:WaitForChild("Humanoid")

local frame = script.Parent
local textBox = frame:WaitForChild("TextBox")
local textButton = frame:WaitForChild("TextButton")

local speedValue = player:FindFirstChild("SpeedValue")
if not speedValue then
	speedValue = Instance.new("IntValue")
	speedValue.Name = "SpeedValue"
	speedValue.Value = 16
	speedValue.Parent = player
end

humanoid.WalkSpeed = speedValue.Value

textButton.MouseButton1Click:Connect(function()
	if textBox.Text:len() > 0 then
		local number = tonumber(textBox.Text)
		if number then
			if number < 100 then
				humanoid.WalkSpeed = number
				speedValue.Value = number
			end
		end
	end
end)

userInput.InputBegan:Connect(function(inputObject, gameProcessedEvent)
	if gameProcessedEvent then return end

	if inputObject.KeyCode == Enum.KeyCode.RightControl then
		frame.Visible = not frame.Visible
	end
end)

Here’s a working version of your script with some structural/logic changes implemented, I’ll attach a model file below so you can download the resource.

repro.rbxm (7.3 KB)