I have this script that's supposed to change the transparency of everything in 2 models, I know that the problem is selecting all of them but I don't know how to fix it.

Script:

local button = workspace.button.ClickDetector
local tower = workspace.tower:GetChildren()
local sign = workspace.sign.SurfaceGui.TextLabel
local cover = workspace.cover:GetChildren()

button.MouseClick:Connect(function(onclicked)
	sign.Text = "Activating Simulation. Please wait."
	tower.Transparency = 0.9
	cover.Transparency = 0.9
	wait(0.5)
	tower.Transparency = 0.8
	cover.Transparency = 0.8
	wait(0.5)
	tower.Transparency = 0.7
	cover.Transparency = 0.7
	wait(0.5)
	tower.Transparency = 0.6
	cover.Transparency = 0.6
	wait(0.5)
	tower.Transparency = 0.5
	cover.Transparency = 0.5
	wait(0.5)
	tower.Transparency = 0.4
	cover.Transparency = 0.4
	wait(0.5)
	tower.Transparency = 0.3
	cover.Transparency = 0.3
	wait(0.5)
	tower.Transparency = 0.2
	cover.Transparency = 0.2
	wait(0.5)
	tower.Transparency = 0.1
	cover.Transparency = 0.1
	wait(0.5)
	tower.Transparency = 0
	cover.Transparency = 0
	wait(0.5)
	sign.Text = "Simulation loaded, you may now begin"
	wait(5)
	sign.Text = "Click to deactivate simulation"
end)

2 comments

0

You can use tables and a for loop to make it more easy.

0

How would I do that?