I have a simple team change script that also changes the clothes but always changes the clothes to the terrorist side clothes, any help is appreciated.
Video: https://streamable.com/b3al2c
Explorer: https://imgur.com/a/Ltseznk
Code:
local TC = Instance.new("RemoteEvent")
TC.Name = "TeamChanger"
TC.Parent = game.ReplicatedStorage
local teams = game.Teams
TC.OnServerEvent:Connect(function(Player, TeamName)
Player.Team = game.Teams[TeamName]
Player:LoadCharacter()
char = Player.Character
if Player.Team == "Counter Terrorists" then
if char:FindFirstChild("Shirt") then
char.Shirt:Destroy()
end
if char:FindFirstChild("Pants") then
char.Pants:Destroy()
end
local shirt = teams["Counter Terrorists"].Shirt:Clone()
shirt.Parent = char
local pants = teams["Counter Terrorists"].Pants:Clone()
pants.Parent = char
else
if char:FindFirstChild("Shirt") then
char.Shirt:Destroy()
end
if char:FindFirstChild("Pants") then
char.Pants:Destroy()
end
local shirt = teams["Terrorists"].Shirt:Clone()
shirt.Parent = char
local pants = teams["Terrorists"].Pants:Clone()
pants.Parent = char
end
end)

1 comment
Line 12 should either check if the player's team name is equal to "Counter Terrorists" or if the player's team is equal to the actual team object (ie game.Teams["Counter Terrorists"]. Right now, you're asking if the team object is equal to a string.