I am trying to make a custom walkspeed system. Here's how it works: There's a textbox where you type in a number in. The textbox has a value inside it. The textbox text should be in that value. But when I type in the number I want my walkspeed to be, it changes it to zero. Any help?
Here's what I've tried:
local speed = script.Parent.Speed.SpeedValue
local textBox = speed.Parent
local player = game.Players.LocalPlayer
local playerGui = player.PlayerGui
local walkspeedGui = playerGui.Sprint
local function changeSpeed()
local text = textBox.Text
if text ~= nil then
textBox.Text = speed.Value
local humanoid = player.Character:FindFirstChild("Humanoid")
if humanoid ~= nil then
humanoid.WalkSpeed = speed.Value
end
end
end
textBox.FocusLost:Connect(function(enterPressed)
changeSpeed()
end)

1 comment
Here's what the Gui looks like: https://photos.google.com/photo/AF1QipMF-aRuSsm2mBazTKtHByQiZXMAU3NEtmtTapAR