Every time I run this function and put the the Gui's position it creates the Points position at (0,0,0,0) why and how do I fix it?
Local Script(Updated):
local Player = game.Players.LocalPlayer
-----------------------------------------
function CreateGui()
local ScreenGui = Instance.new("ScreenGui",Player.PlayerGui)
ScreenGui.Name = "Stuff"
local Frame = Instance.new("Frame",ScreenGui)
Frame.Position = UDim2.new(0,350 ,0,200)
Frame.Size = UDim2.new(0,100 ,0,100)
return Frame
end
-----------------------------------------
function CreatePoints(Position)
print("Given Position for function CreatePoints() is: ",Position)
-----------------
function FindScreenGui()
local Found = Player.PlayerGui:FindFirstChild("Stuff")
if not Found then
local ScreenGui = Instance.new("ScreenGui",Player.PlayerGui)
return ScreenGui
else
return Found
end
-----------------
end
local ScreenGui = FindScreenGui()
local Point = Instance.new("Frame",ScreenGui)
Point.Position = Position
Point.Size = UDim2.new(0,10 ,0,10)
-- Point.BackgroundColor = Color3.new(255/255,0/255,0/255)-- I'll fix part later
return Point
end
-----------------------------------------
function GetCenterOfGui(Gui)
absoluteXS = Gui.AbsoluteSize.X
absoluteYS = Gui.AbsoluteSize.Y
absoluteXP = Gui.AbsolutePosition.X
absoluteYP = Gui.AbsolutePosition.Y
return UDim2.new(0, absoluteXP + (absoluteXS/2), 0, absoluteYP + (absoluteYS/2))
end
-----------------------------------------
local Gui = CreateGui()
--local Point = CreatePoints(UDim2.new(Gui.Position.X.Scale
-- ,Gui.Position.X.Offset,
-- Gui.Position.Y.Scale,
-- Gui.Position.Y.Offset))
local Middle = GetCenterOfGui(Gui)
local Point = CreatePoints(Middle)

3 comments
Thanks,It worked and I mixed it with other question you helped with to get the middle of a GUI,but it doesn't look like it's the middle.
Here is how the point came out: http://i.imgur.com/4WhLNQP.png?1?3328
OOOHH!!!! I messed up! I ADDED the Size instead of SUBTRACT it. That should fix it.