Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
-2

Why is this Script that is Supposed to Affect a Specific Team not Working?

Asked by 10 years ago

So the script is supposed to remove the clothes of a specific team and give them new ones that are provided by the game, with the other team(s) being unaffected by the script. However, the script is not working at all. Can someone please help me? Here's the script:

local team2 = game.Teams:findFirstChild("DF")

local t2shirt = game.Lighting:findFirstChild("DF1")

local t2pants = game.Lighting:findFirstChild("DF2")

function onSpawn(player)

wait(5) -- takes time for the clothes to load

local clothing = player.Character:GetChildren()

for i = 1, #clothing do 

if player.TeamColor == ("Bright green") then
if clothing[i].className == "Pants" or clothing[i].className == "Shirt" then
clothing[i]:remove() 
end
end

end

if player.TeamColor == team2.TeamColor then

t2shirt:Clone().Parent = player.Character
t2pants:Clone().Parent = player.Character

end

end



function A(new)
new.Changed:connect(function(N) if N == "Character" then onSpawn(new) end end)
end

game.Players.ChildAdded:connect(A) 
0
Does using "bump" work here? CoolJohnnyboy 121 — 10y

Answer this question