How can I set a player's walkspeed through a textbox?

What I want to do: Create a text box that allows the players to set speed
The issue: Not changing the speed when I do set it via textbox

Here is my code, What’s wrong with it?

local player = game.Players.LocalPlayer
local setspeed = script.Parent.Parent.TextBox.Text
local hum = game.Workspace:WaitForChild(player.Name).Humanoid
if hum then
	hum.WalkSpeed = setspeed
end

Two things. The first is you should use tonumber(string) on thr textbox’s text to make it into a number. Second, the script only sets the speed once, so i recommend connecting the speed changing code to TextBox.FocusLost.

so like

local player = game.Players.LocalPlayer
local setspeed = script.Parent.Parent.TextBox.Text
setspeed:tonumber(setspeed)
local hum = game.Workspace:WaitForChild(player.Name).Humanoid
if hum then
	hum.WalkSpeed = setspeed
end

? I have really never worked with GUIs before

You would do setspeed = tonumber(setspeed). You should also connect to focus lost so it updates the player’s speed every time they enter a new value like so:

local lplr = game:GetService("Players").LocalPlayer
local textBox = script.Parent.Parent.TextBox

local function updateSpeed()
lplr.Character:FindFirstChildOfClass("Humanoid").WalkSpeed = tonumber(textBox.Text)
end

textBox.FocusLost:Connect(updateSpeed)
updateSpeed()

Ahh it’s not working, To hell with it i’ll just go find something on YouTube.