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

How to change the walkspeed depending on team?

I have tried but no luck. Help please?

2 answers

I'd do something like this-

local TeamSpeeds = {
	-- ["team color"] = walkspeed
	["White"] = 16,
	["Really black"] = 32
}

Game:GetService("Players").PlayerAdded:connect(function(plr) -- when a player joins
	plr.CharacterAdded:connect(function(char) -- when that player respawns
		if TeamSpeeds[plr.TeamColor.Name] then -- if their team is found in TeamSpeeds
			char:WaitForChild("Humanoid").WalkSpeed = TeamSpeeds[plr.TeamColor.Name] -- set their walk speed to what is set in the table TeamSpeeds
		end
	end)
end)

Where is my +1.

--TochiWasHere

function GetSpeedByTeam(color,speed)
	for i, v in pairs(game.Players:GetPlayers()) do
		tmclr = tostring(v.TeamColor)
		if tmclr == color then 
			v.Character.Humanoid.WalkSpeed = speed
		else
			wait()
		end
	end
end

GetSpeedByTeam("White",100)
GetSpeedByTeam("Black",500)

--add more here if you have more teams and make sure you spell the teamcolor CORRECTLY.

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