UI tweened to 0,0 instead of assigned place

the problem is in the title.

  • the gui is on a part meaning its a surface ui
  • the tween position is to a place of the screen of the part to say
  • but tweening the part anywhere causes problems

code:

local Event = game.ReplicatedStorage.ChestUIEvent
local ChestGui = game.StarterGui.ChestGui

local OriginalTransitionPostion = UDim2.new({0.5, 0},{0.5, -5})

local TweenService = game:GetService("TweenService")

local ChestTweenGoal = {}
ChestTweenGoal.Position = UDim2.new({.5, 0},{0.5, -5})

--THE TWEENING DOES HAPPEN JUST TO THE WRONG POSITION
local function ShowUI(Chest)
	local NewChestGui = ChestGui:Clone()
	NewChestGui.Parent = Chest.UI
	NewChestGui.Adornee = Chest.UI
	local ChestTween = TweenService:Create(NewChestGui.Transition, TweenInfo.new(1, Enum.EasingStyle.Linear), ChestTweenGoal)
	ChestTween:Play()
end

Event.OnClientEvent:Connect(ShowUI)

heres a video if u want
robloxapp-20240612-1318564.wmv (294.0 KB)

What is the AnchorPoint of this GUI instance (NewChestGui.Transition)? I think that it moves like that because the value of AnchorPoint is set to 1,1. If my assumption is correct, change the value to 0.5,0.5.

1 Like

however that indeed is the anchor point :sob:

From what i can see, you most likely want to use the Udim2.new constructor that takes in 4 parameters (xScale, xOffset, yScale, yOffset), not 2 tables.
UDim2.new({.5, 0},{0.5, -5})UDim2.new(.5, 0, 0.5, -5)

2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.