I made this script to apply an catalogue item ( ID = id of catalogue item) to an player but somehow this script just works when never any other shirt was applied to the player since he joined the game as soon as I change the player shirt this script doesnt works anymore it just wirks on the very first change how can I fix that ? ( no error codes )
local InsertService = game:GetService("InsertService")
local item
local character
game.ReplicatedStorage.Clothing.ApplyCustomShirt.OnServerEvent:Connect(function(player, ID)
character = player.Character or player.CharacterAdded:Wait()
local success, errorcode = pcall(function()
item = InsertService:LoadAsset(ID)
end)
if success then
if item:FindFirstChild("Shirt") then
if character:FindFirstChild("Shirt") then
character.Shirt:Destroy()
end
item:FindFirstChild("Shirt").Parent = character
end
else
print("Error " .. tostring(player) .. " " .. errorcode)
game.ReplicatedStorage.Clothing.ApplyCustomShirt:FireClient(player, errorcode)
end
end)