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

Im making my own admin i was wondering something about a walkspeed command?

So how can i fix if someones types ws 100 that the player gets 100 walkspeed

Here is my attampt

if script.Parent.Text == ("ws".. num = NumberRange(0,1000)) then
	game.Players.LocalPlayer.Character.Humanoid.Walkspeed = num 
end

1 answer

✓ Accepted answer

If you want it typed from a GUI, I'm not sure how to do it, but I can help you with a chat command:

game.Players.PlayerAdded:Connect(function(player)
	player.Chatted:Connect(function(message)
		if string.split(message," ")[1] == "ws" then
			local speed = string.split(message," ")[2]
			if speed >= 0 and speed <= 1000 then
				player.Character.Humanoid.WalkSpeed = speed
			end
		end
	end)
end)

In this example, when a player chats "ws 100", their speed will become 100. If they want a walk speed higher than 1000, the command will not fire.

Of course, if you're making many admin commands, there are many ways to shorten the given script.

Hope this helps!

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