Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How to change walkspeed through a text box?

Hello there! I would like to know some ways to change the player's walkspeed to whatever they typed in a text box on their screen, similar to a game on ROBLOX called Noob Train by Pandoozle. Here is the link if you would like to go see what I am talking about:

https://www.roblox.com/games/4655652068/Noob-Train-Alpha

What I am asking may be a little big, but any help is appreciated.

1 answer

✓ Accepted answer

Hi! Scripting Helpers is not a request site, but I'm feeling extra generous today.

Here's what you'll need:

https://developer.roblox.com/en-us/api-reference/function/RemoteEvent/FireServer

First off, we need a text box. Make a ScreenGui and in it, make a TextBox. Keep the name TextBox.

Now, create a RemoteEvent. Put it in ReplicatedStorage.

Ok, in the TextBox make a LocalScript.

We'll start off by detecting when the text changes.

script.Parent:GetPropertyChangedSignal("Text"):Connect(function()
	
end)

All done? Now, we need to fire the remote event.

script.Parent:GetPropertyChangedSignal("Text"):Connect(function()
	game:GetService("ReplicatedStorage").RemoteEvent:FireServer(script.Parent.Text) -- Fire the RemoteEvent and pass the Text params
end)

Time to move to the server. Make a server script and put it anywhere.

Let's make the code.

local RE = game:GetService("ReplicatedStorage").RemoteEvent
function RE.OnServerInvoke(plr, args)
	
end

Now we need to change the walkspeed.

local RE = game:GetService("ReplicatedStorage").RemoteEvent
function RE.OnServerInvoke(plr, args) -- The first param of any OnServerInvoke is always the player
	local hum = plr.Character.Humanoid
	if tonumber(args) then -- Check to see if args is a number
		hum.WalkSpeed = args -- Change the walkspeed
	end
end

Hope this helped!

12 comments

0

Thank you so much!

0

Why not change WalkSpeed on the client?

0

Could you mark it as answer again? I accidentally edited it.

0

Changing walkspeed on the client is unreliable.

0

It's not unreliable, it just fools anti-exploits sometimes.

0

I would suggest not doing it.

0

I got an error in the server script, line 2 saying that OnServerInvoke isnot a valid member of RemoteEvent. I am currently trying to fix it.

0

Do OnServerEvent instead. My mistake.

0

On Server Invoke isn't a function of remote event, it's a function of remote function.

0

Thanks!

0

Hmm, It says OnServerEvent isn't a valid member of remote event either... That's weird, I'm sure it is...

0

That's strange. I'm not sure how to fix that. It's not working

This discussion is preserved as it was. New answers, comments, and votes are closed.