I am trying to make a module that makes an instant New Frame
but this is the error i get every single time i run my code: Workspace.ROS_API:55: attempt to call a table value
my code:
function module.create_app(parent) local main_frame = Instance.new('Frame') local top_frame = Instance.new('Frame') main_frame.Parent = parent main_frame.Size = UDim2(0, 1084,0, 673)--I get my error on this. main_frame.Position = UDim2(0.5, -50,0.5, -50) top_frame.Parent = main_frame top_frame.Size = UDim2(0, 1009,0, 28) top_frame.Position = UDim2(0.5, -50,0, 0) return(main_frame) end
It's a very simple error. You are trying to call UDim2 which is a table, replace it with UDim2.new
function module.create_app(parent) local main_frame = Instance.new("Frame") local top_frame = Instance.new("Frame") main_frame.Size = UDim2.new(0, 1084, 0, 673) main_frame.Position = UDim2.new(0.5, -50, 0.5, -50) main_frame.Parent = parent top_frame.Size = UDim2.new(0, 1009, 0, 28) top_frame.Position = UDim2.new(0.5, -50, 0, 0) top_frame.Parent = main_frame return main_frame end
You are calling UDim2 which is essentially a class in terms of OOP.
The method you are looking for is UDim2.new() which will allow you to construct an object of the type UDim2.
So it would instead look like:
main_frame.Size = UDim2.new(0, 1084,0, 673)
Which as you may know already is similar to Color3.new and Vector3.new
Hope that helps, Vathriel