Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How would I make a textlabel slide to the top right of the frame with my script?

Asked by 4 years ago

How would make a textlabel slide from the center of a frame to the top right of the screen with this script?

1.  Wait(23)
2.  script.Parent:TweenPosition(UDim2.new(0,0,0,0),'In','Back',1)

0
Am I doing this wrong Eyelesstiamat 7 — 4y
0
use wait() instead of Wait() maumaumaumaumaumua 628 — 4y

3 answers

Log in to vote
0
Answered by 4 years ago

Alright so you need to specify a little bit more, but essentially, if you want it to be hidden in the corner out of the screen view, you'd set it's UDim to this:

script.Parent:TweenPosition(UDim2.new(1,0,0,0),'In','Back',1)

However, if you want it to be visible, you would have to know what it's X and Y sizes are. So say that it is 200x100 (Width x Height). You would do something like this:

script.Parent:TweenPosition(UDim2.new(1,-100,0,0),'In','Back',1)

You can also add some padding by using the offsets.

Ad
Log in to vote
0
Answered by 4 years ago

By putting the GUI to the center and using that script via localscript

Log in to vote
0
Answered by
pingsock 111
4 years ago

This must be in a LocalScript.

local ScreenGui = Instance.new("ScreenGui",game.Players.LocalPlayer:WaitForChild("PlayerGui"))
local Frame = Instance.new("Frame",ScreenGui)
Frame.Size = UDim2.new(0, 100,0, 100)
local UIAspectRatioConstraint = Instance.new("UIAspectRatioConstraint",Frame)
UIAspectRatioConstraint.AspectRatio = 1.004
UIAspectRatioConstraint.AspectType = Enum.AspectType.FitWithinMaxSize
UIAspectRatioConstraint.DominantAxis = Enum.DominantAxis.Width

-- Using UIAspectRadioConstraint, this makes sure that the size doesn't get changed through any device with any resolution, not sure if I did it perfectly, but I'm definitely sure it works most the time.

function ChangeCorner(Corner)
if Corner == "TopRight" then
Frame:TweenPosition(UDim2.new(0.921, 0,-0, 0),'In','Back',1)
elseif Corner == "TopLeft" then
-- You do whatever here if you want, I was just using this function for references.
end
end

-- When you join, you should see it after 5 seconds.
wait(5)
ChangeCorner("TopRight")

-- Thanks for using ~ pingsock.

You may configure this all you'd like to. I took my time to make this for you, enjoy.

Answer this question