I have not seemed to figure this out yet...
COMMUNITY QUESTION
How to change player parts ontouch?
2 answers
This script loops through all the parts in the player when the player touches the scripts parent and sets the transparency of all the parts in player to 1.
script.Parent.Touched:connect(function(hit)
--we now know part "hit" has touched "TouchedPart"
if hit.Parent:FindFirstChild("Humanoid", true) then
for i, v in pairs(hit.Parent:GetChildren()) do
if v:IsA("Basepart") then
v.Transparency = 1
end
end
end
end)
function onTouched(hit) -- function
local torso = hit:FindFirstChild("Torso")
local rightleg = hit:FindFirstChild("RightLeg")
local rightArm = hit:FindFirstChild("RightArm")
local leftLeg = hit:FindFirstChild("LeftLeg")
local leftArm = hit:FindFirstChild("LeftArm")
local headfoil = hit:FindFirstChild("Head")
torso.Transparency = 1
rightArm.Transparency = 1
rightleg.Transparency = 1
leftArm.Transparency = 1
leftLeg.Transparency = 1
headfoil.Transparency = 1
end
script.Parent.Touched:connect (onTouched) --listener
This discussion is preserved as it was. New answers, comments, and votes are closed.
