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)
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)
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.
By putting the GUI to the center and using that script via localscript
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.
This discussion is preserved as it was. New answers, comments, and votes are closed.
2 comments
Am I doing this wrong
use wait() instead of Wait()