Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

model disappearing on touch not working?

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

2 comments

1

Would you mind giving us any hierarchy?

0

Sorry about that, its workspace/Group/4 parts

1 answer

✓ Accepted answer

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

2 comments

0

Thank you very much!

0

No problem.

This discussion is preserved as it was. New answers, comments, and votes are closed.