Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Changing speed with a TextBox, speed not changing correctly?

Asked by 5 years ago
Edited 5 years ago

I'm pretty new at scripting and i've been working on a gui to change your walkspeed. I've made a TextBox where you type in a number and a TextButton that you click to change your walkspeed to the number. If I make the number 16 in studio and then test it, my speed will be changed to 16 (the default speed) However, when I change the text and click the TextButton, it stays at 16.

Here is the LocalScript in the Textbutton

local player = game.Players.LocalPlayer
local char = player.Character
local text = script.Parent.Parent.SpeedBox.Text
script.Parent.MouseButton1Click:connect(function()
char.Humanoid.WalkSpeed = text
print("current speed =",text)
end)

There are no Errors in the output, if someone could help me out i'd appreciate it.

Here is the full GUI

0
You're assigning a string to a value that should be a number, use char,Humanoid.WalkSpeed = tonumber(text) Cynmorphic 0 — 5y
0
Also you need to add a infinite loop to check it. You can do like, local enabled = true; while wait() and enabled == true do (the code thingy); enabled = false, breaking the loop ClockWallie 28 — 5y
0
So far these solutions haven't worked, if you need to look at the full gui go ahead and do so https://ghostbin.com/paste/tc85w/raw 0oSingularityo0 0 — 5y

Answer this question