In part of my ServerScript, I want script to destroy the Shirt inside the player's character, if they have a shirt in their character. The script is, like I said, a ServerScript found inside the player's character.
local char = script.Parent if char:FindFirstChild("Shirt") ~= nil then char:FindFirstChild("Shirt"):Destroy() end
After running the code stated above, nothing happens. Can someone please help me?
So, you would wait until the character has loaded everything by using CharacterAppearanceLoaded.
Example of how you would do it:
game:GetService("Players").PlayerAdded:Connect(function(Player) Player.CharacterAppearanceLoaded:Connect(function(Char) local Shirt = Char:FindFirstChildOfClass("Shirt") if (Shirt) then Shirt:Destroy() end end) end)