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

Walkspeed change when on a specific team?

local Players = game:GetService("Players")
local humSpeed = 15
local zomSpeed = 20
local LocalPlayer = Players.LocalPlayer
local Character = LocalPlayer.Character or LocalPlayer.CharacterAdded:wait()

Character:WaitForChild("Humanoid").Died:Connect(function()
	print(Players.Team.Name)
	if Players.Team.Name == "zombie" then
      Character:WaitForChild("Humanoid").WalkSpeed = zomSpeed
	else
      Character:WaitForChild("Humanoid").WalkSpeed = humSpeed
	end
	end)

When a players dies it checks for the team if he goes to that team then his walkspeed is that team's walkspeed.

I have a script for when a player dies it changes to the opposite team.

The output didnt give any errors.

Please help! Thanks in advance!

2 comments

0

Try using the brickcolor thing

0

If the humanoid dies, It'll reset the local script lol

1 answer

I'm not sure if this would work, but maybe you should try this:

local humSpeed = 15
local zomSpeed = 20
local Players = game:GetService("Players")
local Teams = game:GetService("Teams")

Players.CharacterAdded:Connect(function(player)
	if Player.Team = Teams.zombie then
		game.Players.LocalPlayer.Character.Humanoid.Walkspeed = zomSpeed
	else
		game.Players.LocalPlayer.Character.Humanoid.Walkspeed = humSpeed	
	end
end)

Or you can stick with your script, but according to the wiki; The Team property is a reference to a Team object within the Teams Service.

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