Moving image is not moving to the exact position

I have a script which moves an image, the problem is that it’s not moving to the exact position, here is the part where the script creates a tween:

local t = ts:Create(
     logo, --object being tweened
     TweenInfo.new( -- holds information about our tween
           1, -- duration
           Enum.EasingStyle.Quad, --EasingStyle
           Enum.EasingDirection.Out, --EasingDirection
           0, --Repeat count
           false, -- if true, the tween reverses after completion
           0 -- delay time
     ),
     {
           Position = UDim2.new(logoend.Position) -- moves to the right
     }
)

The black block is the image, and the invisible block that im holding in the image is the position of logoend. The image is not going to that position.

How i fix that? Thanks for reading

1 Like

Also, here is how it looks when i playtest:

You don’t need to wrap it in the UDim2, because the position is already a UDim2. You can do:

{ 
     Position = logoend.Position;
}

Now it’s error printing: Unable to cast to Dictionary

@SansariGames - Again, it’s error printing: Unable to cast to Dictionary
@MrLegendaryDoge - 0,0


If you need the entire script, here i’ll leave it:

local ts = game:GetService("TweenService")
local logo = script.Parent.Logo
local text = script.Parent.Tittle
local BG = script.Parent.BG
local logoend = script.Parent.LogoEnd
local textend = script.Parent.TittleEnd

local t = ts:Create(
     logo, --object being tweened
     TweenInfo.new( -- holds information about our tween
           1, -- duration
           Enum.EasingStyle.Quad, --EasingStyle
           Enum.EasingDirection.Out, --EasingDirection
           0, --Repeat count
           false, -- if true, the tween reverses after completion
           0 -- delay time
     ),
     {
           Position = UDim2.new(logoend.Position.X,logoend.Position.Y); -- moves to the right
     }
)

local ta = ts:Create(
     logo, --object being tweened
     TweenInfo.new( -- holds information about our tween
           1, -- duration
           Enum.EasingStyle.Quad, --EasingStyle
           Enum.EasingDirection.In, --EasingDirection
           0, --Repeat count
           false, -- if true, the tween reverses after completion
           0 -- delay time
     ),
     {
           Position = 0.055, 0,0.331, 0 ; -- moves to the right
     }
)

local t1 = ts:Create(
     text, --object being tweened
     TweenInfo.new( -- holds information about our tween
           1, -- duration
           Enum.EasingStyle.Quad, --EasingStyle
           Enum.EasingDirection.Out, --EasingDirection
           0, --Repeat count
           false, -- if true, the tween reverses after completion
           0 -- delay time
     ),
     {
           Position = UDim2.new(textend.Position.X,textend.Position.Y); -- moves to the right
     }
)

local ta1 = ts:Create(
     text, --object being tweened
     TweenInfo.new( -- holds information about our tween
           1, -- duration
           Enum.EasingStyle.Quad, --EasingStyle
           Enum.EasingDirection.In, --EasingDirection
           0, --Repeat count
           false, -- if true, the tween reverses after completion
           0 -- delay time
     ),
     {
           Position = 0.64, 0,0.403, 0; -- moves to the right
     }
)


local tweenInfo = TweenInfo.new(0.5, Enum.EasingStyle.Linear)
local t2 = ts:Create(logo, tweenInfo, {ImageTransparency = 0})
local t21 = ts:Create(logo, tweenInfo, {ImageTransparency = 1})


wait(5)

t:Play()
t2:Play()

wait(3)
t21:Play()

ta:Play()

Position = Udim2.new( 0.055, 0,0.331, 0 );

Position = Udim2.new( 0.64, 0,0.403, 0 );

This should do it.

Again the image is going to the corner, that’s AnchorPoint issue?

Remove all the position offsets from the GUI objects.

logo.AnchorPoint = logoend.AnchorPoint
logo:TweenPosition(logoend.Position,"Out","Quad",1,false)