How do I make the part non-transparent again?

https://streamable.com/vxvech

The helmet is supposed to become transparent when retracted (which I’ve done succesfully) and nontransparent again when protracted which I can’t get to work.

This is the block of the script that handles the transparency:

local function CloseHelmet()
	if HelmetOpened == true then
		HelmetOpened = false
		local Time = 0.5
		local CloseGoal = {}
		CloseGoal.Value = PivotCentre
		local Tween = TweenService:Create(WeldPivotCentreValue,Info,CloseGoal)
		local NonTransparentTween = TweenService:Create(Helmet,TweenInfo.new(Time),{Transparency = 0})
		Tween:Play()
	end
	
end

local function OpenHelmet()
	if HelmetOpened == false then
		HelmetOpened = true
		local Time = 0.5
		local OpenGoal = {}
		OpenGoal.Value = PivotCentre * CFrame.Angles(math.deg(80),0,0)
		local Tween = TweenService:Create(WeldPivotCentreValue,Info,OpenGoal)
		local TransparentTween = TweenService:Create(Helmet,TweenInfo.new(Time),{Transparency = 1})
		Tween:Play()
		TransparentTween:Play()
	end
end

while true do
	wait(10)
	CloseHelmet()
	wait(2)
	OpenHelmet()
end

I tried to reverse the steps I did to make the part transparent, why isn’t it working?

In your loop can you print(HelmetOpened) and can you also add a print in the OpenHelmet function right after Tween:Play(). Just print something random after you play the tween just so we can see if its actually running.

Make sure you have output open and tell us the results.

The results came out true and “Hello” which I printed after Tween:Play(), so it does work. It repeats in the loop too so it’s likely just an issue with the transparency stuff.

Is print(HelmetOpened) always true?

Uhm what exactly do you mean by this?

Like is the result of print(HelmetOpened) always true? or does it print false when CloseHelmet is fired?

Ok when I print (HelmetClosed), this comes up in the output:

function: 0x76cb58d9908a0431

No, I mean the bool print(HelmetOpened) that you used in your if statements if HelmetOpened == false then. I want to see if its actually turning false since you said it was only true.

Yep I printed it and it’s false.

I noticed that you forgot to play your NonTransparentTween in the CloseHelmet() function. I think thats your issue since you defined the tween but haven’t actually played it!

God damn I’m actually dumb LOL.

Don’t worry, I’ve made similar mistakes in the past too! Glad we found out what the issue was tho!