I've been trying to script, a simple script, that changes the players Accessories and Limbs to a different Material, which was a huge success.
However, I know that players don't always wear clothes, but instead use Body Colors. So I'm trying to update my script to detect if the players are wearing anything, and if they aren't, to cloth them with a shader outfit, so the Material doesn't show on the players.
local shirt = script:WaitForChild("ShadowShirt")
local function Checkshirt(character)
for i, object in pairs(character:FindFirstChild()) do
if object:IsA("Shirt") then --Breaks here sometimes
print("All Good here!")
elseif character.Shirt ~= nil then --And here most of the time
shirt:Clone().Parent = character
end
end
end
How do I go about scripting the detection of the shirt, and if there is no shirt, verifying that the shirt doesn't exsist?

1 comment
Thanks alot! this did the trick.