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

Detailed multi-part garage door, transparent or collision not working, can someone tell me way?

Trying to make a garage door open but not working, I don't where I am going wrong. it has 9 parts. It's a sensor team door. s is sensor A to K is the door children. IF ROBLOX make select parent children instance like :ClearAllChildren instance, this will be easier.


s = script.Parent 
a = script.Parent.Parent.Door.Part1  
b = script.Parent.Parent.Door.Part2 
c = script.Parent.Parent.Door.Part3 
d = script.Parent.Parent.Door.Part4 
e = script.Parent.Parent.Door.Part5 
f = script.Parent.Parent.Door.Part6 
g = script.Parent.Parent.Door.Part7 
h = script.Parent.Parent.Door.Part8 
k = script.Parent.Parent.Door.Part9
Player = Player.Touched
if Player.hit(s) and Player.TeamColor == BrickColor.new ("Institutional white")then
function onTouched(hit)
	a.Transperency = 1
	a.CanCollide = false
	b.Transperency = 1
	b.CanCollide = false
	c.Transperency = 1
	c.CanCollide = false
	d.Transperency = 1
	d.CanCollide = false
	e.Transperency = 1
	e.CanCollide = false
	f.Transperency = 1
	f.CanCollide = false
	g.Transperency = 1
	g.CanCollide = false
	h.Transperency = 1
	h.CanCollide = false
	k.Transperency = 1
	k.CanCollide = false
	wait (2)
	a.Transperency = 0
	a.CanCollide = true
	b.Transperency = 0
	b.CanCollide = true
	c.Transperency = 0
	c.CanCollide = true
	d.Transperency = 0
	d.CanCollide = true
	e.Transperency = 0
	e.CanCollide = true
	f.Transperency = 0
	f.CanCollide = true
	g.Transperency = 0
	g.CanCollide = true
	h.Transperency = 0
	h.CanCollide = true
	k.Transperency = 0
	k.CanCollide = true
	script.Parent.Touched:connect(onTouched)
end
end

1 answer

✓ Accepted answer
local MainPart = script.Parent
local Model = MainPart.Parent

function toggleVisibility(bool)
	if bool == false then
		for i,v in pairs(Model:GetChildren()) do
			v.Transparency = 1
		end
	else
		for i,v in pairs(Model:GetChildren()) do
			v.Transparency = 0
		end
	end
end

function onTouched(touched)
	toggleVisibility(false)
	wait(2)
	toggleVisiblilty(true)
end

MainPart.Touched:Connect(onTouched)

1 comment

0

The script works but, it can't work like team door, I been trying modify it to make so a team touch it then it opens.

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