Gamepass integration

I have an option in my game where people can spawn as two seperate spiders, the spider, and the spiderling. I am trying to implement this so that if they have a gamepass it will allow them to spawn in for free. However, this keeps returning as nil. How could I write this instead so that it works properly? It should spawn them in for free if they are either the certain group rank or they have the gamepass.

elseif species == "Special" then
        local protein = player.leaderstats.Protein
        local classPrice = priceModule[class]
        local rank = player:GetRankInGroup(4525406)
        print (rank >= 249)
                
        if class == "Spider" then --own a gamepass
            if MarketplaceService:UserOwnsGamePassAsync(player.UserId, 113845236) then
                print"owns spider gp"
                canSpawn = true
            end
        elseif class == "Spiderling" then --own a gamepass
            if MarketplaceService:UserOwnsGamePassAsync(player.UserId, 113843356) or player.Name == "Player1" then
                print "owns spiderling gp"
                canSpawn = true
            end
        elseif rank >= 249 or protein.Value >= priceModule[class].Price then --if staff or have enough protein
            print"staff or has enough protein"
            if rank < 249 then
                protein.Value = protein.Value - priceModule[class].Price
            end
            canSpawn = true
        end
        
        if canSpawn == true then
            SpawningFunctionsModule:SpawnSpecial(player,species,colony,class)
            return canSpawn
        else
            return nil
        end

Here is the local script!

playButton.MouseButton1Click:Connect(function()
	if colony ~= nil then
		local result = remotes.SpawnPlayer:InvokeServer({colony = colony, species = species, class = class})
		print(result)
		if result ~= nil then
			workspace.Camera.CameraSubject = player.Character
			workspace.Camera.CameraType = "Custom"
			gameHUD()
			menu:Destroy()
		else
			classInfoFrame:WaitForChild("Message").Text = "Wait for the Queen to lay eggs!"
		end
		
	end
end)