The script in serverscriptservice:
01 | local Frame = Instance.new( "Frame" ) |
02 | local ScreenGui = Instance.new( "ScreenGui" ) |
03 | local StarterGui = game.StarterGui |
04 | ScreenGui.Parent = StarterGui |
05 | Frame.Parent = ScreenGui |
06 | Frame.Position "{0, 0},{0, 0}" |
07 | Frame.Size "{0, 100},{0, 100}" |
08 | if Frame.Visible = = false then |
09 | Frame.Visible = true |
10 | end |
01 | local Frame = Instance.new( "Frame" ) |
02 | local ScreenGui = Instance.new( "ScreenGui" ) |
03 | local PlayerGui = game.Players.LocalPlayer.PlayerGui |
04 | ScreenGui.Parent = PlayerGui |
05 | Frame.Parent = ScreenGui |
06 | Frame.Position = UDim 2. new( 0 , 0 , 0 , 0 ) |
07 | Frame.Size = UDim 2. new( 0 , 100 , 0 , 100 ) |
08 | if Frame.Visible = = false then |
09 | Frame.Visible = true |
10 | end |
The correct way on setting gui position is by using Udim2.new
:
01 | local Frame = Instance.new( "Frame" ) |
02 | local ScreenGui = Instance.new( "ScreenGui" ) |
03 | local StarterGui = game.StarterGui |
04 | ScreenGui.Parent = StarterGui |
05 | Frame.Parent = ScreenGui |
06 | Frame.Position Udim 2. new( 0 , 0 , 0 , 0 ) |
07 | Frame.Size Udim 2. new( 0 , 100 , 0 , 100 ) |
08 | if Frame.Visible = = false then |
09 | Frame.Visible = true |
10 | end |
Easy
1 | local ScreenGui = Instance.new( "ScreenGui" ,game.Players.LocalPlayer.PlayerGui) |
2 | local Frame = Instance.new( "Frame" ,ScreenGui) |
3 | Frame.Position Udim 2. new( 0 , 0 , 0 , 0 ) |
4 | Frame.Size Udim 2. new( 0 , 100 , 0 , 100 ) |
5 | if Frame.Visible = = false then |
6 | Frame.Visible = true |
7 | end |