Hi, i did a script that when put inside a Character, it's suppose to remove his clothes and put his skin into rock using Material, i am using a R15 Rigs so the body part are MeshPart Here's my script:
local shirt = script.Parent.Shirt local pants = script.Parent.Pants wait(2) shirt.Parent = nil pants.Parent = nil local child = script.Parent:GetChildren() local brick = child.Material wait(1) if (child.className == "MeshPart") then brick = Enum.Material.Concrete end
Weirdly, it don't seem to work, i am not a professional with script so i can't quite figure out why.
You can use IsA to check the part type
local shirt = script.Parent.Shirt local pants = script.Parent.Pants wait(2) shirt.Parent = nil pants.Parent = nil local child = script.Parent:GetChildren() local brick = child.Material wait(1) if child:IsA(“MeshPart”) then brick = Enum.Material.Concrete end