would anyone have a clue how to do this?
It would be something like this:
script.Parent.Touched:Connect(function(hit) if hit.Parent:FindFirstChild("Humanoid") then for _,v in pairs(hit.Parent:GetChildren()) do if v:IsA("BasePart") then v.Transparency = 0.5 end end end end)
Hey lopehole12,
local part = script.Parent; -- The part that is being touched. part.Touched:Connect(function(obj) -- Anonymous function local hum = obj.Parent:FindFirstChild("Humanoid"); -- Humanoid of the player(If it is a player that touched the part.) if hum then -- Checks if the humanoid exists to see if it is a player. local char = obj.Parent; -- The character of the player local objs = char:GetChildren(); -- A table with all of the Userdata values/Instances/Objects inside of the Character. for _, object in next, objs do -- A for each iteration that goes through the said table and gives a variable to each instance/userdata value it is iterating through as 'object' if object:IsA("BasePart") then -- Checks if it's a Basepart(Basically if it is a limb) object.Transparency = 1; -- Makes the part Transparent. end -- end for the BasePart if statement. if object:IsA("Accessory") or object.Name == "Head" then -- Checks if it is an accessory or if the object is the head. local irr = object:FindFirstChild("Handle") or object:FindFirstChild("face"); -- If it is an Accessory, it should have a child called "Handle" and if it is a Head, it should have the child called Face, making both of these transparent helps get rid of the problem of the Face and Accessories being visible. The 'or' is like a ternary operator, it either goes with the handle or with the face. irr.Transparency = 1; -- Makes the part/decal invisible. end -- end for the Accessory, Head if statement end -- end for the for each iteration end -- end for the humanoid if statement end) -- end for the function as a whole.
~~ KingLoneCat