Hello!, i have a script that works very well, but sometimes it give me a error on console saying like "Shirt was not found on (player name)", is there any way to if script dont found the shirt on avatar, the script create a shirt and put inside the player who touched the part? heres my script :
local ChangerPart = script.Parent local ShirtTemplate = "http://www.roblox.com/asset/?id=1234" local PantsTemplate = "http://www.roblox.com/asset/?id=1234" ChangerPart.Touched:Connect(function(TouchPart) if TouchPart and TouchPart.Parent and TouchPart.Parent:FindFirstChild("Humanoid") then print(TouchPart.Parent.Name .. " - Changed clothes") local Character = TouchPart.Parent Character.Shirt.ShirtTemplate = ShirtTemplate Character.Pants.PantsTemplate = PantsTemplate wait(3) end end)
Also this script its from a youtube tutorial channel, but i made some changes!
Add this after line 8:
if Character.Shirt == nil then --check if the character has a shirt, if it doesn't then it the script will return nil Instance.new("Shirt", Character) --make a new shirt instance and parent it to the character end