Ok, so I'm trying to make my script make a union's transparency go to 0 while making the others 1 and to each union vice versa. Here's the script:

local ClickHere = script.Parent.Parent.ClickHere
local PlateEmp = script.Parent.Parent.PlateEmp
local PlateInv = script.Parent.Parent.PlateInv
local Plate1 = script.Parent.Parent.Plate1
local Plate2 = script.Parent.Parent.Plate2
local Plate3 = script.Parent.Parent.Plate3

function click()
	if PlateInv.Transparency == 1 then
		PlateEmp.Transparency = 0
		Plate1.Transparency = 1
		Plate2.Transparency = 1
		Plate3.Transparency = 1
	if PlateEmp.Transparency == 0 then
		PlateEmp.Transparency = 1
		Plate1.Transparency = 0
		Plate2.Transparency = 1
		Plate3.Transparency = 1
	end
end

script.Parent.ClickDetector.MouseClick:Connect(click)

This is the pattern I'm trying to create:

PlateInv (Invisible) -> PlateEmp (Empty) -> Plate1 -> Plate2 -> Plate 3 -> Back to PlateInv

I am trying to make it so when the player clicks the Click Detector in the brick, they will go from PlateInv to PlateEmp (The pattern) then back to PlateInv when they click the last plate. Does anyone know how to achieve this?

(BTW I am aware that this script only contains 2 unions transparency changing but that is because I want to fix this before continuing on with the other unions.)

1 comment

0

Not an answer, but I recommend a for loop.. "for i,v in pairs(script.Parent.Parent:GetChildren()) do" also, instead of making all your variables "script.Parent.Parent." set a variable that is "script.Parent.Parent" so "local temp = script.Parent.Parent" and make them like "temp.ClickHere" or "temp.PlateEMP"