Indexing number with Gui script error

Hello, everyone!

I’m trying to make a GUI that teleports someone to a new game. There’s also a No option on the Gui that just closes it. For some reason, it errors when I click the gui stating:

Players.iy_uhn.PlayerGui.GameGui.Frame.NoButton.Script:5: attempt to index number with 'PlayerGui'

Here’s my script:

local nButton = script.Parent -- TextButton
    print("No Button Pressed.")
    local pGui = player.PlayerGui 
        pGui.GameGui.Frame:TweenPosition(, 0, -0.2, 0), "Out", "Quint", 1, true)

Anyone know what’s up?

MouseButtonUp does not take the player as the parameter, you have to get thee player with the

local player = game.Players.LocalPlayer

Hence, use

local player = game.Players.LocalPlayer
...(Other parts of code)....
local pGui = player:WaitForChild("PlayerGui")

Also, instead of getting the frame through the playerGui, I recommend using script.Parent… until you reach the target frame instance.