I am trying to changing a Auto Equip Armor Script to a Auto Equip Team Armor. But, I have no idea how to do so.
Script:
game.Players.PlayerAdded:Connect(onPlayerRespawned)
function onPlayerRespawned(newPlayer)
local armor = game.ServerStorage.EpicArmor:Clone()
armor.Parent = newPlayer.Character
for index, armorParts in pairs(armor:GetChildren()) do
for index, playerParts in pairs(newPlayer.Character:GetChildren()) do
if playerParts:IsA("BasePart") then
if armorParts.Name == playerParts.Name then
armorParts.PrimaryPart.CFrame = playerParts.CFrame
local weld = Instance.new("WeldConstraint")
weld.Part0 = playerParts
weld.Part1 = armorParts.PrimaryPart
weld.Parent = armorParts.PrimaryPart
end
end
end
end
end
function onPlayerEntered(newPlayer)
newPlayer.Changed:Connect(function (property)
if (property == "Character") then
onPlayerRespawned(newPlayer)
end
end)
end
game.Players.PlayerAdded:Connect(onPlayerEntered)