Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Why does this stop working after I respawn even though its a CharacterAdded function?

game.Players.PlayerAdded:Connect(function(plr)
	plr.CharacterAdded:Connect(function(chr)
		repeat wait(.1) until chr:IsDescendantOf(game.Workspace)
		
		--Shirt
		if chr:FindFirstChild("Shirt") == nil then
			local shirt = Instance.new("Shirt",chr)
			shirt.ShirtTemplate = "http://www.roblox.com/asset/?id=132601069"
		elseif chr:FindFirstChild("Shirt") then
			chr.Shirt:Destroy()
			local shirt = Instance.new("Shirt",chr)
			shirt.ShirtTemplate = "http://www.roblox.com/asset/?id=132601069"
		end
		
		--Pants
		if chr:FindFirstChild("Pants") == nil then
			local Pants = Instance.new("Pants",chr)
			Pants.PantsTemplate = "http://www.roblox.com/asset/?id=132601229"
		elseif chr:FindFirstChild("Pants") then
			chr:FindFirstChild("Pants").PantsTemplate = "http://www.roblox.com/asset/?id=132601229"
		end
		
		--Hats
		for i,v in pairs(chr:GetChildren()) do
			if v.ClassName == "Accessory" then
				v:Destroy()
				else
			end
		--Body Color	
			if v.Name == "Body Colors" then
				v.HeadColor = BrickColor.new("Baby blue")
			end
		end	
		
	end)	
end)

It works when I press play but then if I reset, it only sets the pants and shirt, and doesn't get rid of the accessories nor makes my head blue. Why?

3 comments

0

yeah my post was about the appearance too

0

output errors?

0

Nope. No output errors.

1 answer

Make sure you're character auto loads is set to false

5 comments

0

your*

0

StarterPlayer properties LoadCharacterAppearance shouldn't be ticked.

0

Nvm I fixed it. Just made it wait a bit longer.

0

But yeah you just reminded me about LoadCharacterAppearance. I'm gonna un-tick that now.

0

Exacly, LoadCharacter() respawns your character instantly, as I stated clearly. Np

This discussion is preserved as it was. New answers, comments, and votes are closed.