After an object is tweened, it doesn't show on the screen

Hello,

I’m working on a new window system where a LocalScript inside the StarterGUI controls all window’s animations. Initially, it would be a ModuleScript, but it gave me the same problem.

Instead, I’ve tried doing what I’ve just mentioned rather than a ModuleScript and the same happened.

Here’s the script I’ve mentioned:

-- Windows
local CollectionService = game:GetService("CollectionService")
local TweenService = game:GetService("TweenService")

local DefaultValues = {
	CloseSize = UDim2.fromScale(0,0),
	Time = 0.4,
	EasingStyle = Enum.EasingStyle.Circular,
	EasingDirection = Enum.EasingDirection.InOut
}


for _, Window in pairs(CollectionService:GetTagged("Window")) do

	local CloseTween = TweenService:Create(Window, TweenInfo.new(DefaultValues.Time, DefaultValues.EasingStyle, DefaultValues.EasingDirection), {Position = Window:GetAttribute("ClosePosition"), Size = DefaultValues.CloseSize})
	local OpenTween = TweenService:Create(Window, TweenInfo.new(DefaultValues.Time, DefaultValues.EasingStyle, DefaultValues.EasingDirection), {Position = Window:GetAttribute("OpenPosition"), Size = Window:GetAttribute("OpenSize")})

	local function CheckIfOpen() -- Checks if the window is open and animates accordingly
		if Window:GetAttribute("Open") == true then
			print("Triggered")
			OpenTween:Play()
			OpenTween.Completed:Wait()
			print("Tween worked")

		elseif Window:GetAttribute("Open") == false then
			CloseTween:Play()

		end
	end

	CheckIfOpen() -- Initially checks if the window is open before there is any other action
	
	Window:GetAttributeChangedSignal("Open"):Connect(function() -- Checks if there's a change in the "Open" value
		CheckIfOpen()		
	end)
end

Here’s the result:
Streamable Link

This is quite devastating for my project. I’m not sure what I can do about it. Urgent help is appreciated because I can’t continue the UI rework without this tween issue being resolved…

Here’s the Roblox game that you’re seeing in the snippet above. :slight_smile:
UITest.rbxl (58.8 KB)

Thanks and Happy Bloxy Colas!
Akridiki

We’ve filed a ticket into our internal database for this issue and will start investigating, we will update you when we have further information.

Thanks for flagging!

1 Like