Script not changing position or giving error

Okay, so the title is self explanatory and there’s 2 branches upon this problem. The first one is, this error:

Here’s the script:
This script is not the full script

local frame = Instance.new("Frame")
	frame.Size = Vector2.new(gui.Size.X, gui.Size.Y - Vector2.new(0,36))
	frame.Position = Vector2.new(gui.Position.X, gui.Position.Y -  Vector2.new(0,36))
	frame.Parent = screengui

It’s happening in the second line of this snippet.

Yes, I’ve tried following the error but it done this:

Edited code:

local frame = Instance.new("Frame")
frame.Size = Vector2.new(gui.Size.X, gui.Size.Y - UDim.new(0,36))
frame.Position = Vector2.new(gui.Position.X, gui.Position.Y - UDim.new(0,36))
frame.Parent = screengui

Error:

local frame = Instance.new("Frame")
	frame.Size = Vector2.new(gui.Size.X, gui.Size.Y - UDim2.new(0,36))
	frame.Position = Vector2.new(gui.Position.X, gui.Position.Y - UDim2.new(0,36))
	frame.Parent = screengui

Error:

Now, here comes the second problem, when I tried setting the frames position overall, it didn’t work at all. Not even if I set it up in a totally fresh script. I need an explanation on why I’m unable to edit the position(even with no errors).

Size and Position is a UDim2 not a Vector2.

local frame = Instance.new("Frame")
frame.Size = UDim2.fromOffset(gui.Size.X.Offset, gui.Size.Y.Offset - 36)
frame.Position = UDim2.fromOffset(gui.Position.X.Offset, gui.Position.Y.Offset - 36)
frame.Parent = screengui

I did that and it gave me this error:

Tried this and it just instanced a frame and that’s it:

local frame = Instance.new("Frame")

frame.Size = UDim2.fromOffset(gui.Size.X, gui.Size.Y - UDim.new(0,36))

frame.Position = UDim2.fromOffset(gui.Position.X, gui.Position.Y - UDim.new(0,36))

frame.Parent = screengui

My bad, I forgot to use the offset property in my previous reply.

You’re script was close to working, it just didn’t set the position at all:

image