Im trying to tween my gui in whichever direction its rotated in.
I found this post that tells how to do it with offset but I wanna do it with scale so it moves to the same position on all screens.
Im trying to tween my gui in whichever direction its rotated in.
I found this post that tells how to do it with offset but I wanna do it with scale so it moves to the same position on all screens.
local frame = script.Parent.Frame
local function tween(newY)
frame:TweenPosition(UDim2.new(0,frame.Position.X.Scale+ math.tan(math.rad(frame.Rotation))*(frame.Position.Y.Scale-newY),0,newY))
end
Have you tried this
my bad the code was slightly different, this is it
local function tween(newY)
frame:TweenPosition(UDim2.new(frame.Position.X.Scale,frame.Position.X.Offset + math.tan(math.rad(frame.Rotation))*(frame.Position.Y.Offset-newY),frame.Position.Y.Scale,newY))
end
when i change it to
local function tween(newY)
frame:TweenPosition(UDim2.new(0,frame.Position.X.Scale+ math.tan(math.rad(frame.Rotation))*(frame.Position.Y.Scale-newY),0,newY))
end
or
local function tween(newY)
frame:TweenPosition(UDim2.new(frame.Position.X.Scale,frame.Position.X.Scale+ math.tan(math.rad(frame.Rotation))*(frame.Position.Y.Scale-newY),frame.Position.X.Scale,newY))
end
it no longer goes in the right direction