Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

model disappearing on touch not working?

Asked by
Exsius 162
10 years ago

I tried to make a script that touching a part of a model will set the all the parts in the model to become transparent. I tried using

function onTouched(hit)
    script.Parent.Parent.Door.A1.Transparency= 1
    script.Parent.Parent.Door.A2.Transparency= 1
    script.Parent.Parent.Door.A3.Transparency= 1
    script.Parent.Parent.Door.A4.Transparency= 1       
end
script.Parent.Touched:connect(onTouched)

but it wouldn't any help will be appreciated

Thanks,

Exsius

1
Would you mind giving us any hierarchy? User#2 0 — 10y
0
Sorry about that, its workspace/Group/4 parts Exsius 162 — 10y

1 answer

Log in to vote
-1
Answered by 10 years ago

EDITED: The below script should work:

script.Parent.Touched:connect(function(t) -- Anonymous functions.
    for _, v in pairs(game:GetService("Workspace").Door:GetChildren()) do
        v.Transparency = 1
    end
end)

Anonymous functions

Generic for

0
Thank you very much! Exsius 162 — 10y
0
No problem. RaverKiller 668 — 10y
Ad

Answer this question