local team = nil --replace
local textbutton = script.Parent
local template = textbutton.ShirtTemplateName
textbutton.MouseButton1Click:Connect(function()
for _,player in ipairs(team:GetPlayers()) do
local chara = player.Character
local shirt = chara:FindFirstChild("ShirtTemplate")
if shirt then
shirt:Destroy()
local newShirt = template:Clone()
newShirt.Parent = chara
else
local newShirt = template:Clone()
newShirt.Parent = chara
end
end
end)
as you said, didnt work lol
Local script or Script?
local team = game.Teams.Away
local textbutton = script.Parent
local template = textbutton.Shirt
textbutton.MouseButton1Click:Connect(function()
for _,player in ipairs(team:GetPlayers()) do
local chara = player.Character
local shirt = chara:FindFirstChild("ShirtTemplate")
if shirt then
shirt:Destroy()
local newShirt = template:Clone()
newShirt.Parent = chara
end
end
end)
local team = nil --replace
local textbutton = script.Parent
local template = textbutton.ShirtTemplateName
textbutton.MouseButton1Click:Connect(function()
for _,player in ipairs(team:GetPlayers()) do
local chara = player.Character
local shirt = chara:FindFirstChild("Shirt")
if shirt then
shirt:Destroy()
local newShirt = template:Clone()
newShirt.Parent = chara
else
local newShirt = template:Clone()
newShirt.Parent = chara
end
end
end)
i just fixed some things, should work i think (i made it so it will add the shirt if the player doesn’t have a shirt/it can’t find a shirt)