UDIM2 tween not working

so here is my code (localscript):

local norm = 0.058
local up = -1
local goal = {}
goal.Position = UDim2.fromScale(.068,norm)
local goal1 = {}
goal.Position = UDim2.fromScale(.068,up)
local e = game.TweenService:Create(script.Parent,TweenInfo.new(3),goal)
local eup = game.TweenService:Create(script.Parent,TweenInfo.new(3),goal1)
game.ReplicatedStorage.gui.OnClientEvent:Connect(function(toggle,tex)
	if toggle == true then
		script.Parent.TextLabel.Text = tex
		e:Play()
	else
		eup:Play()
	end
end)

im using scale for screen compatibility but it just doesnt work with no errors? what am i doing wrong?

What script is calling the gui Event? Also, you don’t need to do toggle == true. You can instead just do toggle.

A script located inside a model in the workspace. the actual gui event is in replicated storage

Have you made sure to check that the event is actually firing?

Yes i have. {character limit ignore}

Is the GUI inside of a tool, StarterGui, or any other place?

The localscript is inside startergui.

To tween Position of Gui elements, you need to use the :TweenPosition() function instead of using TweenService.

For example:

script.Parent:TweenPosition(Udim2Position)

You can also set duration and easing styles; however, it is in a different order to TweenService.

That moment right here is actually interesting for me, like are you fr defining a TABLE’s position??

just do this instead

local goal = UDim2.fromScale(.068,norm)
local goal1 = UDim2.fromScale(.068,up)

im not defining the tables position im adding the position to the table.

To add the position into a table you must use either table.insert or table[whatever] = whatever

i have been using this way for years and it has never failed me. using it this way adds a name and its value to the table and thats what ive always done.

Well, okay then
But, why would you need to put the position inside of a table though?

its the only way tweenservice accepts it

Oh, i just found your problem

You had to do here this

game.TweenService:Create(script.Parent,TweenInfo.new(3),{Position = goal})

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