Hi, I’m making a script that changes a Humanoids walkspeed if they are on a team.
The problem is, it won’t change it in the while loop, I checked and the humanoid walkspeed is at 30, and the player is on the team, there are no errors in the console.
script.Parent.Humanoid.MaxHealth = 750
script.Parent.Humanoid.WalkSpeed = 30
script.Parent.Humanoid.Health = script.Parent.Humanoid.MaxHealth
game.Players.PlayerAdded:Connect (function(player)
while player.Team == game.Teams.SCPS do
script.Parent.Humanoid.WalkSpeed = 0
wait(5)
script.Parent.Humanoid.WalkSpeed = 30
wait(4)
end
end)
local Team = game:GetService("Teams")["SCPS"]
for _, player in pairs(game.Players:GetPlayers()) do
while player.Team == Team do
script.Parent.Humanoid.WalkSpeed = 0
wait(5)
script.Parent.Humanoid.WalkSpeed = 30
wait(4)
end
end
local Players = game:GetService(“Player”)
function PlayedAdded(Player)
local function CharacterAdded(Character)
repeat wait() until Character:IsDescendantOf(workspace)
while Player.Team == Team do
Player.Character.Humanoid.WalkSpeed = 0
wait(5)
Player.Character.Humanoid.WalkSpeed = 30
wait(4)
end
end
Player.CharacterAdded:connect(CharacterAdded)
end
Players.PlayerAdded:connect(PlayedAdded)
for _,Player in pairs(Player:GetPlayers()) do
PlayerAdded(Player)
end
I am not sure if this is what you are looking for.