When I try running this code, i get the errors

11:03:56.400 - Occupied is not a valid member of Workspace 11:03:56.401 - Script 'Players.Player1.PlayerGui.Main.Module.Core', Line 15 11:03:56.401 - Stack End 11:04:01.903 - Players.Player1.PlayerGui.Main.Module.Core:73: attempt to index field 'Value' (a nil value) 11:04:01.904 - Stack Begin 11:04:01.904 - Script 'Players.Player1.PlayerGui.Main.Module.Core', Line 73 - global onKeyDown 11:04:01.904 - Script 'Players.Player1.PlayerGui.Main.Module.Core', Line 79 11:04:01.904 - Stack End

Here's the code, im still confused as to why it happens:

local Players = game:GetService("Players")
local cam = game.Workspace.CurrentCamera
local player = game.Players.LocalPlayer
local ship = script.Parent.ShipLocation.Value
local base = ship.Parts.Base
local mouse = player:GetMouse()
local gui = player.PlayerGui:WaitForChild("Main")
local dock = script.Parent.Dock.Value
local portlocation = script.Parent.PortLock.Value

mouse.Move:connect(function()
	if mouse.Target then
		local distance = (base.Position - mouse.Target.Position).magnitude
		if mouse.Target.Parent:FindFirstChild("Occupied") and distance < 5 then 
			if mouse.Target.Parent.Occupied.Value == false then
				if script.Parent.CurrentlyDocked.Value == false then
					gui.Control.Bottom.Dock.Visible = true
					dock = true
				else
					gui.Control.Bottom.Dock.Visible = false
					dock = false
				end
			else
				gui.Control.Bottom.Dock.Visible = false
				dock = false
			end
		else
			gui.Control.Bottom.Dock.Visible = false
			dock = false
		end
	end
end)

function onKeyDown(key, mouse) 
	local target = mouse.Target	
	key:lower() 	
	if mouse.Target and mouse.Target.Parent:FindFirstChild("Occupied") then
		if dock == true then
			if script.Parent.Travelling.Value == true then
				print("ending")
				ship.PrimaryPart = ship.Parts.PortLockFront
			else
				print("beginning")
				ship.PrimaryPart = ship.Parts.PortLockBack
			end
			gui.Control.Bottom.Undock.Visible = true
			gui.Control.Bottom.Dock.Visible = false
			local occupied = mouse.Target.Parent:FindFirstChild("Occupied")
			occupied.Parent.Occupied.Value = true
			portlocation = mouse.Target.Parent:FindFirstChild("PortBase")
			portlocation.Transparency = 1
			script.Parent.CurrentlyDocked.Value = true
			dock = false
			ship:SetPrimaryPartCFrame(portlocation.Parent:GetPrimaryPartCFrame())
			script.Parent.FerryControl.Throttle.Value = 0
			script.Parent.FerryControl.Disabled = true
			for i,v in pairs(ship.Parts.WaterTrails:GetChildren()) do
				v.ParticleEmitter.Enabled = false
			end
		end
	end
	if key == "q" and script.Parent.CurrentlyDocked.Value == true then
		if script.Parent.Travelling.Value == true then
			script.Parent.Travelling.Value = false
		else
			script.Parent.Travelling.Value = true
		end
		dock = false
		ship.PrimaryPart = ship.Parts.Base
		script.Parent.CurrentlyDocked.Value = false
		gui.Control.Bottom.Undock.Visible = false
		portlocation = mouse.Target.Parent:FindFirstChild("PortBase")
		script.Parent.PortLock.Value.Transparency = 0.9
		script.Parent.PortLock.Value.Parent.Occupied.Value = false
		script.Parent.FerryControl.Disabled = false
	end
end

mouse.KeyDown:connect(function(key) onKeyDown(key, mouse) end)	

If you need anything, go ahead and comment, i'd be extremely grateful if i find the issue, thanks.