I want to have a script that gives you your team clothes when you enter the game. This is the script I have. In the Output it says Line 29 global removepants, line 40 global on PLayer Respawned, and something about line 53. It doesnt work when you spawn, and the clothing temples are the children of the script.
function removeShirt(character)
while character:findFirstChild("Shirt")~=nil do character.Shirt:remove() end --Removes current shirt
end
function removePants(character)
while character:findFirstChild("Pants")~=nil do character.Pants:remove() end --Removes current Pants
end
function removeTShirt(character)
if character:findFirstChild("Torso") and character.Torso:findFirstChild("roblox") then --Removes current TShirt
character.Torso.roblox:remove()
end -- The Functions above remove the new players clothing
end
function onPlayerRespawned(newPlayer)
if newPlayer.TeamColor == game.Teams["Atlas"].TeamColor then --Checks to see if the player is on the team
removePants(char)
removeShirt(char) --Removes clothing
shirt3 = script.Clothing2:clone()
shirt4 = script.Pants2:clone()
shirt3.Parent = char --Clones and equips the new uniform
shirt4.Parent = char
return
end
end
function onPlayerEntered(newPlayer)
newPlayer.Changed:connect(function (property)
if (property == "Character") then
onPlayerRespawned(newPlayer) -- Checks if the Player is a Character
end
end)
end
game.Players.PlayerAdded:connect(onPlayerEntered)

1 comment
.....