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

How to give certain people walkspeed?

I am a roblox scripter and i have made lots of successful games but how do i give certain people walkspeed?

1 comment

0

if player.UserId == 123456 then player.Character.Humanoid.WalkSpeed = 26 end

3 answers

✓ Accepted answer

WalkSpeed is a property of the Humanoid.

If you want to set a specific persons walkspeed to something, use an if-statement to check if the player's userId is equal to the specific player your looking for.

This is an example that'll give you a rough overview of how setting walkspeed works in general:

local Players = game:GetService("Players")
local SET_WALKSPEED = 32

for _, Player in pairs(Players:GetPlayers()) do
	local Character = Player.Character or Player.CharacterAdded:wait()
	if Character then
		local Humanoid = Character:FindFirstChild("Humanoid")
		if Humanoid then
			Humanoid.WalkSpeed = SET_WALKSPEED
		end
	end
end

4 comments

0

He said a certain person in the game.

0

thank you guys :)

0

thank you guys :)\

0

yes

Put this in a ServerScript, then you can either put the ServerScript in ServerScriptService or the Workspace.

local SpecialPeople = {} -- Paste your wanted player's userid inside the empty table.
local CustomWalkspeed = 20 -- Your preferred walkspeed. 

game.Players.PlayerAdded:Connect(function(Player)
	Player.CharacterAdded:Connect(function(Character)
		for i = 1, #SpecialPeople do
			if Player.UserId == SpecialPeople[i] then
				warn(Player.Name.." has joined the game.")
				local Humanoid = Character:WaitForChild("Humanoid")
				Humanoid.WalkSpeed = CustomWalkspeed
			end
		end
	end)
end)

1 comment

0

What if you want it random?

local certainpeople = {"PlayerName","Person"} -- put persons' names here
local certainid = {1234567, 2345678} -- put persons' user ids here
local takename = true -- put true if you want the player name to be identified.
-- put false if you want the player id to be identified
local speed = 25 -- change the value to the speed you want them to have

game.Players.PlayerAdded:Connect(function(player)
	if takename == true then
		for i, x in pairs(certainpeople) do
			if string.lower(player.Name) == string.lower(x) then
				player.Character.Humanoid.WalkSpeed = speed
			end
		end
	elseif takename == false then
		for i, x in pairs(certainid) do
			if player.UserId == x then
				player.Character.Humanoid.WalkSpeed = speed
			end
		end
	end
end)

Tell me in the comments if it doesn't work.

2 comments

0

Put in ServerScriptService.

0

yay

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