Player's clothes not changing?

You may have to replace that line with

    Workspace.ChildAdded:Connect(function(player) 
        if game.Players:GetPlayerFromCharacter(player) then

Honestly it should trigger when you use CharacterAdded, so add a print line and see if anything happens

it prints when it’s added… why isn’t it changing the clothes

  game.Players.PlayerAdded:Connect(function(player)
    	local plr = workspace:WaitForChild(player.Name)
    	player.CharacterAdded:Connect(function(character)
    		print("added!")
    			if player.Team == game.Teams["A team"] then
    				if player:GetRankInGroup(group) >= rank then 
    					plr.Shirt.ShirtTemplate = "http://www.roblox.com/asset/?id=shirt"
    					plr.Pants.PantsTemplate = "http://www.roblox.com/asset/?id=pants"
    				end
    	end) 
    end)

it prints “added”

Check the further if statements with a print and see how far it gets.

Everything prints… ill try adding repeat wait() until player:HasAppearanceLoaded() (found on another forum post) maybe it’s happening too fast

Still nothing… any other ideas?

You can try plr:WaitForChild(‘Shirt’).ShirtTemplate which will be more precise, although just create a shirt for them because if they’re not already wearing one it won’t work

What do you mean ‘create a shirt for them’?

I figured it out. I needed to define plr AFTER CharacterLoaded

I cannot believe I just noticed this now… thanks for your help @Blue_Jays @GladlyAshley @SonGoku6325 !

1 Like

Yes, so

teamAShirt = Instance.new('Shirt')
teamAShirt.ShirtTemplate = "333333333"

then

    if player:GetRankInGroup(group) >= rank then 
    	newShirt = teamAShirt:Clone()
        newShirt.Parent = character
    	newPants = teamAPants:Clone()
        newPants.Parent = character
    end

You will need to remove the shirt/pants they are already wearing, of course

try this out, characterappearanceloaded is the same as characteradded but it fires after the appearance has fully loaded(shirts&pants included), you also need to create a new shirt and pants when they aren’t wearing any

local shirtID = 0
local pantsID = 0

local group = 0
local rank = 0

game.Players.PlayerAdded:Connect(function(player)
	
	player.CharacterAppearanceLoaded:Connect(function(character)
		if player:GetRankInGroup(group) >= rank then
			local Shirt = character:FindFirstChildOfClass('Shirt')
			local Pants = character:FindFirstChildOfClass('Pants')
			if Shirt then
				Shirt.ShirtTemplate = 'rbxassetid://'..shirtID
			else
				Shirt = Instance.new('Shirt')
				Shirt.ShirtTemplate = 'rbxassetid://'..shirtID
				Shirt.Parent = character
			end
			if Pants then
				Pants.PantsTemplate = 'rbxassetid://'..pantsID
			else
				Pants = Instance.new('Pants')
				Pants.PantsTemplate = 'rbxassetid://'..pantsID
				Pants.Parent = character
			end
		end
	end)
	
end)
1 Like