So I'm trying to make a game with rounds and different laser guns and I have no idea how I would go about making a shop script. I have a gui and buttons setup I just don't know how I would link the item purchased to the player when they spawn. I've tried putting values in their starterplayer and looking for those but that doesn't work.

local function WaitForChild(parent, childName)
	assert(parent, "ERROR: WaitForChild: parent is nil")
	while not parent:FindFirstChild(childName) do parent.ChildAdded:wait() end
	return parent[childName]
end
local replicatedstorage = game:GetService('ReplicatedStorage')
local ingame = replicatedstorage:WaitForChild('InGame')
local status = replicatedstorage:WaitForChild('InfoValue')
local mapid = 'Map1'
local GamePassService = game:GetService('GamePassService')
local PlayersService = game:GetService('Players')
local GamePassIdObject = WaitForChild(script, 'GamePassId')
local mapstorage = game.Workspace:WaitForChild('MapStorage')
local StarterPack = game:WaitForChild('StarterPack')
local Player = game.Players.LocalPlayer
local vip = false
PassId = 863524072
local function OnPlayerAdded(player)
	print("deez nuts, ha got em")
end
game:GetService("Players").PlayerAdded:connect(function(Player)
if game:GetService("GamePassService"):PlayerHasPass(Player, PassId) then
	local vip = true
	print(Player.Name,"has the gamepass")
else
	print(Player.Name,"does not have the gamepass")
end

if vip == true then
	print(Player.Name,"has set their variable true")
else
	print(Player.Name,"has set their variable false")
end

end)

local player = game.Players.LocalPlayer
while true do

if game.Players.NumPlayers < 2 then
	SoundIds = {"146943635"}
	Sound = Instance.new("Sound",game.Workspace)
	Sound.Volume = 1
	Sound.Looped = true
		Current = SoundIds[math.random(1,#SoundIds)]
		wait(1)
		Sound.SoundId = "http://www.roblox.com/asset?id="..Current
		Sound:Play()
end
while game.Players.NumPlayers < 2 do
	status.Value = 'There needs to be atleast 2 players to begin!'
	repeat wait(2) until game.Players.NumPlayers >= 2
end
Sound:Stop()

ingame.Value = 'false'
print(ingame)
for i = 15,0,-1 do
	status.Value = 'Intermission... '..i
	wait(1)
end
_G.gameplayers = {}
for i, v in pairs(game.Players:GetPlayers()) do
	
if v then
	table.insert(_G.gameplayers, v.Name)
end
	
end

local mapsinserverstoarge = game:GetService('ServerStorage'):GetChildren()
local chosenmap = mapsinserverstoarge[math.random(1, #mapsinserverstoarge)]
mapid = chosenmap
print(chosenmap)
if mapid == 'Map1' then
	status.Value = 'Factory By iDiamondExtreme'
	wait(3)
else
	if mapid == 'Map2' then
		status.Value = 'Neon Maze By iDiamondExtreme'
		wait(3)
	end
end
chosenmap:Clone().Parent = mapstorage
ingame.Value = 'true'
print(ingame)
status.Value = 'Teleporting...'
wait(3)
local spawns = chosenmap:WaitForChild('Spawns'):GetChildren()
for _, player in pairs(game.Players:GetPlayers()) do
	if player and #spawns > 0 then
		local torso = player.Character:WaitForChild('Torso')
		local allspawns = math.random(1, #spawns)
		local randomspawn = spawns[allspawns]
		if randomspawn and torso then
			table.remove(spawns, allspawns)
			torso.CFrame = CFrame.new(randomspawn.Position + Vector3.new(0,2,0))
			if vip == false then
				local sword = game.ReplicatedStorage.Default
				local newsword = sword:Clone()
				newsword.Parent = player.Backpack
			else
				if vip == true then
				local sword = game.ReplicatedStorage.VIP
				local newsword = sword:Clone()
				newsword.Parent = player.Backpack
				end
			end
		end
	end
end
SoundIds = {"293660120","144938083"}
Sound = Instance.new("Sound",game.Workspace)
Sound.Volume = 1
Sound.Looped = false
	Current = SoundIds[math.random(1,#SoundIds)]
	wait(1)
	Sound.SoundId = "http://www.roblox.com/asset?id="..Current
	Sound:Play()
for i  = 120, 0, -1 do
	if i == 0 then
		status.Value = 'Round Over'
	end
	wait(1)
	if #_G.gameplayers < 2 then
		for i, v in pairs(_G.gameplayers) do
			if v ~= nil then
				status.Value = v..' Is victorious!'
				ingame.Value = 'false'
				print(ingame)
				game.Players[v].leaderstats.Cash.Value = game.Players[v].leaderstats.Cash.Value +15
				game.Players[v].leaderstats.Wins.Value = game.Players[v].leaderstats.Wins.Value +1
				if vip == true then
					game.Players[v].leaderstats.Cash.Value = game.Players[v].leaderstats.Cash.Value +15
				end
			end
			
		end
		break
	else
		status.Value = i..' Seconds Remaining'
	end
end
Sound:Stop()

mapstorage:ClearAllChildren()
wait(5)
SoundIds = {"138086719","345982848","629888507"}
Sound = Instance.new("Sound",game.Workspace)
Sound.Volume = 1
Sound.Looped = false
	Current = SoundIds[math.random(1,#SoundIds)]
	wait(2)
	Sound.SoundId = "http://www.roblox.com/asset?id="..Current
	Sound:Play()
	wait(10)     
	Sound:Stop()
end

I'd really like some help please.