Tween service, help with transparency; and etc

How do I change it so before the part changes color I want the transparency to tweenservice to 0.5 where it fades in and out then when the transparency is done changing to 0.5, to 0 i want the part to change the color


local part = script.Parent

local tweenInfoColor = TweenInfo.new(1, Enum.EasingStyle.Linear, Enum.EasingDirection.InOut, 0, false, 0)


while wait(3.5) do
	
	local randomColor = Color3.fromRGB( math.random(1, 255), math.random(1, 255), math.random(1, 255) )
	
	local Transparency = 0.5
	
	--Dancefloor--
	
	local tween = TweenService:Create(workspace.DanceFloor.DanceTile, tweenInfoColor, {Color = randomColor, Transparency = Transparency})
		tween:Play()
		
		--Stair 1
		for i, Part in pairs(workspace.Stair1.Light:GetChildren()) do
		local StairTween = TweenService:Create(Part, tweenInfoColor, {Color = randomColor, Transparency = Transparency })
			StairTween:Play()
		end
	
	--Stair 2 Ended-
	
	for i, Part in pairs(workspace.Stair2.Light:GetChildren()) do
		local StairTween = TweenService:Create(Part, tweenInfoColor, {Color = randomColor, Transparency = Transparency })
		StairTween:Play()
	end
	
	--Stair 3 Ended--
	
	for i, Part in pairs(workspace.Stair3.Light:GetChildren()) do
		local StairTween = TweenService:Create(Part, tweenInfoColor, {Color = randomColor })
		StairTween:Play()
	end
	
	--Stair 4 Ended--
	
	for i, Part in pairs(workspace.Stair4.Light:GetChildren()) do
		local StairTween = TweenService:Create(Part, tweenInfoColor, {Color = randomColor })
		StairTween:Play()
	end
	
	
	
	--Ramps--- Light(Ye)
	
	for i, Part in pairs(workspace.Ramp1:GetChildren()) do
		local Ramp1Tween = TweenService:Create(Part, tweenInfoColor, {Color = randomColor })
		Ramp1Tween:Play()
	end
	
	
	for i, Part in pairs(workspace.Ramp2:GetChildren()) do
		local Ramp2Tween = TweenService:Create(Part, tweenInfoColor, {Color = randomColor })
		Ramp2Tween:Play()
	end
	
	
	
	---Rooff---
	
	
	--Statue
	
	

	for i, Part in pairs(workspace.Statue.LightUp:GetChildren()) do
		local StatueTween = TweenService:Create(Part, tweenInfoColor, {Color = randomColor })
		StatueTween:Play()
	end
	
-----------------------------------------------------------------------------------------------------------------------------------------------------------
	

	
	-------------------------------------------- Lights ---------------------------------------------------------------------------------
	

	local tween = TweenService:Create(workspace.DanceFloor.Lights.DanceLight.SurfaceLight, tweenInfoColor, {Color = randomColor  })
	tween:Play()
	
	
	
end


Have you tried using

goal = {}
goal.Transparency = 0.5
goal.Color = Color3.fromRGBColor3.fromRGB( math.random(1, 255), math.random(1, 255), math.random(1, 255))

would this fade in smoothly? Cause I don’t want it to randomly just be 0.5 and thats it.

So I assume you want your part to change a color, go to 0.5 transparency and then go back to 0 and change the color again, in an infinite loop?

yes that’s exactly what im trynna do but then after 20 seconds or so I want the part to go transparent fully 1 of them and wait 20 seconds and from 1 transparency to 0 i have a aquarium under the dancefloor i want to show

Okay so basically you would make a while loop and this loop will constantly run!
In the loop you will generate a random color, after that you will tween that transparency to 0.5 and once it is completed, you make a tween that goes back to 0 transparency and then you generate the color again!
You can put task.wait(20) for waiting 20 seconds and then make another tween that goes to transparency 1 and waits again and then back to 0. That will be your loop.

Tween.Completed:Wait() will wait for you tween to finish and once it is finished, it will continue with the rest of the code. So I believe you need to define 3 Tweens! Each having different goals for transparency which are 0, 0.5 and 1!

can u demonstate that with a code on my script?