GUI not tweening

Hello! So, as the title explains, my code is not working.

while true do
	wait(2)
	if script.Check == 1 then
		local ts = game:GetService("TweenService")
		local unit = script.Parent
		local goal = {}
		goal.Transparency = 0
		local tw = ts:Create(unit,TweenInfo.new(2,Enum.EasingStyle.Quad,Enum.EasingDirection.InOut,0,true,2),goal)
		tw:Play()
	end
end

Edit: Since there was a lack of info, I will put the missing info here.
Basically what i’m trying to do is make the gui opaque, but my code does not work.
Check is a value inside of the script
Unit Is a TextLabel

This doesnt work due to it doesnt make scense, Please send an image of the explora and output / errors also.

There are no errors or warnings. Forgot to mention but it is in a GUI. Not a part.

Okay so then what’s the issue? Is it that it’s not showing up? Is it that it’s not disappearing?

I do not understand what htis is, I need you to send me an image of what you have under this script and the GUI

image

I also need you to press the arrow next to the script also, i need to see everything under the script.

under the script is a intvalue

also you didnt change the intvalue in the script.
if you dm me on discord i can re-script it for you 10x more efficently. [kieranl29_#3816]

I have changed the value, just in a diffrent script

What is this ui a ui for when you spawn or when you reset your character or when do you want it to appear?

The ui is supposed to appear when a certain weather event has happened

script.Check is wrong; it must be changed to script.Check.Value.
script.Check is an instance and script.Check.Value is a value in string/number form.

I also highly recommend changing while true do to script.Check.Changed:Connect(function() then checking the value as it is more efficient and doesnt repeatedly spam a tween when it does need to show up.

After making sure this is complete, re-try your code and let me know of the result.

Nevermind, it should be changing transparency

Hello, sorry for late reply but, your idea did not work. No errors popped out, the textlabel was not even appearing. To make sure, this is what you wanted me to do right?

script.Check.Changed:Connect(function()
	local ts = game:GetService("TweenService")
	local unit = script.Parent
	local goal = {}
	goal.Transparency = 0
	local tw = ts:Create(unit,TweenInfo.new(2,Enum.EasingStyle.Quad,Enum.EasingDirection.InOut,5,true,2),goal)
	tw:Play()
end)

Please tell me. Thanks!

Ah, I see the issue. Could you please make it a Local Script and try again?

The next issue is: You should also consider the fact UI instances dont have a transparency property. Maybe instead you should use tweenposition, tweening it in/out of the user’s screen, taking consideration for correct size/position scaling too.

1 Like

I’m very sorry but I scraped my Ui idea and instead used a script that messages the chat. However I will use your idea just in case a person has chat off.