Tween Event Doesn't Play

Hello,

I have created a script which would make a UI disseapear/reapear when you go to a certain area, and currently, it doesn’t work. It goes as follows:

local PlazaEvent = script.Parent
local PlazaRemote = game.ReplicatedStorage.Plaza
local character = game.Players.LocalPlayer.Character
local humanoidRootPart = character:WaitForChild("HumanoidRootPart")


UIStart = TweenInfo.new(1,Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0, false, 0)
UIEnd = TweenInfo.new(1,Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0, false, 0)
transparency = game.StarterGui.NewAreas.AreaUI.TextTransparency

UIeventStart = game:GetService("TweenService"):Create(transparency, UIStart, {0})
UIeventEnd = game:GetService("TweenService"):Create(transparency, UIStart, {1})

while true do
	UIeventStart:Play()
	wait(2)
	UIeventEnd:Play()
end

Any help will be appreciated.

The first argument of the tween is the object, so in your case, AreaUI. The third argument must be a table with the property you want to change, and the value to change it to. Like this:

AreaUI, Info, {TextTransparency = 0}

1 Like

This seems to be correct, but it won’t get past the tweening part, the code is as follows:

local PlazaEvent = script.Parent
local PlazaRemote = game.ReplicatedStorage.Plaza
local character = game.Players.LocalPlayer.Character
local humanoidRootPart = character:WaitForChild("HumanoidRootPart")
AreaUI = game.StarterGui.NewAreas.AreaUI

UIStart = TweenInfo.new(1,Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0, false, 0)
UIEnd = TweenInfo.new(1,Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0, false, 0)
transparency = game.StarterGui.NewAreas.AreaUI.TextTransparency

UIeventStart = game:GetService("TweenService"):Create(AreaUI, UIStart, {transparency = 0})
UIeventEnd = game:GetService("TweenService"):Create(AreaUI, UIEnd, {transparency = 1})
print("got past code")

while true do
	UIeventStart:Play()
	wait(2)
	UIeventEnd:Play()
	print("looped!!!")
end

I’m not sure if it is the case here, but it can be a little finicky when addressing a property via a variable, and then assigning that variable to something new with = .

Try to just say TextTransparency where you have put transparency, and see if that solves your issue.

1 Like

Still doesn’t work for some reason. Is there any other reason this could be occurring? If not, I’ll file a bug report. I had a similar glitch when creating a tween which changes the color of the terrain depending on if its day/night

Im not really sure what your issue is. Looking at the code though, I notice that you have a delay after the first tween, but not the second one. ( In the while loop. )

This means the second tween will be immediately overwritten, playing the first tween over and over again.

1 Like

I don’t think this is the problem anymore. Since I made a print after the code finishes, I realized it wasn’t even printing in the first place, which means that something went wrong with the initial code. I don’t see anything wrong with it though, can you?

Possibly an infinite yield when attempting to wait for the root part? If there is nothing in your output, then I don’t know.

Longshot, maybe the script is disabled on accident? lol

Nope, still nothing. Perhaps this is a bug?