So I'm trying to get a script, which when a player joins, it checks if the Player has a Gamepass (which can be purchased in-game too), or if the Player is part of a "permissions" list, where if they have either, or both, then they will receive tools, and some cash, however, upon testing, this doesn't seem to be working. Can someone please help? The script is below.

gps = game:GetService("GamePassService");
permission = {"DerpyShadowz","Player1"};

function checkOkToLetIn(name)
for i = 1,#permission do
-- convert strings to all upper case, otherwise we will let in
-- "Username" but not "username" or "uSERNAME"
if (string.upper(name) == string.upper(permission[i])) then return true end
end
return false
end;

wait(10) -- Just in case the Leaderboard doesn't load first?

Tools = {"Dagger"} -- Exact text--

Respawn_With_Tools = true;  -- False if you don't want the people spawned with it.
--MAKE SURE YOU PUT THE TOOLS IN THE LIGHTING
id = script:WaitForChild("GamePassID"); -- Do not change
game.Players.PlayerAdded:connect(function(Player)
Player:WaitForDataReady()
repeat wait(10) until Player:FindFirstChild("leaderstats")
if gps:PlayerHasPass(Player , id.Value) or (checkOkToLetIn(Player.Name)) then
for i,v in pairs (game.Lighting:GetChildren()) do
for a,c in ipairs (Tools) do
if v:IsA'Tool' and v.Name:lower()==c:lower() then
local adminTool = v:Clone()
if Respawn_With_Tools==true then
adminTool.Parent=Player.StarterGear
adminTool:Clone().Parent=Player.Backpack
elseif Respawn_With_Tools==false then
adminTool.Parent = Player.Backpack
local Player = game.Players:GetPlayerFromCharacter(Player.Parent)
if Player ~= nil then
	if Player.Health > 0 then
		local Stats = game.ServerStorage.PlayerMoney:FindFirstChild(Player.Name)
		if Stats ~= nil then 
		Stats.Value = Stats.Value + 5000 -- Amount of Money to Add
		end
	end
end
		

end
end
end
end
end
end)

-- A "GamePassID" value is a descendant of this script, with the GamePass ID, respectively.