Basically, I want to make a script where one brick is touched and goes transparent and becomes uncollideable, if another brick is hit it will detect that and change to a specific part, in this case, F1S1.
Keep in mind: The parts with the scripts are "hitboxes", and F1 and F1S1 are the bricks being affected.
function onTouched(hit) if script.Parent.Parent.F1.Transparency == 0 then script.Parent.Parent.F1S1.Transparency = 0 script.Parent.Parent.F1S1.CanCollide = true script.Parent.Parent.F1.Transparency = 0 script.Parent.Parent.F1.CanCollide = false end end script.Parent.Touched:connect(onTouched)
Honestly, I'm not sure why you have parts as parents of other parts. You should use a model instead. Try adding :WaitForChild
when trying to get something. Here:
local Part = script.Parent Part.Touched:Conect(function() if Part.Parent.Parent:WaitForChild('F1').Transparency == 0 then Part.Parent:WaitForChild('F1S1').Transparency = 0 Part.Parent:WaitForChild('F1S1').CanCollide = true Part.Parent:WaitForChild('F1').Transparency = 0 Part.Parent:WaitForChild('F1').Transparency = false end end)
If this doesn't work, comment and tell me if there is an error. If this helped you in anyway, please Upvote and accept answer.
-- Your Orange, BlackOrange3343 PS: Good luck on your game