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

Why is this not working?

game:GetService('Players').PlayerAdded:connect(function(player)
    player.CharacterAdded:connect(function(character)
        local s = character:FindFirstChild("Shirt")
        local p = character:FindFirstChild("Pants")
        s:Destroy()
        p:Destroy()
        local shirt = Instance.new("Shirt", character)
        local pants = Instance.new("Pants", character)
        shirt = "shirt template linkie link" --Shirt AssetId
        pants = "pants template linkie link" --Pants AssetId
    end)
end)

I want the pants and shirt to be destroy so the player is just thier chosen skin color. Why isn't it working?

1 answer

✓ Accepted answer

Instead of destroying it, why not use it and change the ShirtTemplate and PantsTemplate property?

game:GetService('Players').PlayerAdded:connect(function(player)
    player.CharacterAdded:connect(function(character)
        local s = character:FindFirstChild("Shirt") or Instance.new("Shirt", character) --Create them if they don't exist
        local p = character:FindFirstChild("Pants") or Instance.new("Pants", character) --Create them if they don't exist
	s.ShirtTemplate = "insert shirt template link here";
	p.PantsTemplate = "insert pants template link here"
    end)
end)

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