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

How to give certain people walkspeed?

Asked by 4 years ago
Edited 4 years ago

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

0
if player.UserId == 123456 then player.Character.Humanoid.WalkSpeed = 26 end jediplocoon 877 — 4y

3 answers

Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

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
0
He said a certain person in the game. SnowieDev 171 — 4y
0
thank you guys :) R0BL0XIANG0D -34 — 4y
0
thank you guys :)\ R0BL0XIANG0D -34 — 4y
0
yes R0BL0XIANG0D -34 — 4y
Ad
Log in to vote
0
Answered by
SnowieDev 171
4 years ago
Edited 4 years ago

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)
0
What if you want it random? Ycool2007 -9 — 4y
Log in to vote
0
Answered by
Geobloxia 251 Moderation Voter
4 years ago
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.

0
Put in ServerScriptService. Geobloxia 251 — 4y
0
yay R0BL0XIANG0D -34 — 4y

Answer this question