Number not interable, why is it a number?

local function giftHandler()
	local function giftPurchaseFinished(player, purchaseID, status)
		if status == true then
			local playerName = game.Players:GetPlayerByUserId(player)
			print(playerName)
			local playerToGift = playerName:FindFirstChild("OtherStats"):FindFirstChild("GiftTo").Value
			if purchaseID == 3370668881 then
				local playerToGiftName
				for i, player in ipairs(game.Players:GetPlayers()) do
					if player.UserId == playerToGift then
						playerToGiftName = player.Name
						print(playerToGiftName.." Got gifted gamepass")
					end
				end
				local val = Instance.new("StringValue",playerToGiftName:FindFirstChild("OtherStats"):FindFirstChild("Gamepasses"))
				val.Name = "X2Seeds"
			end
			player:FindFirstChild("OtherStats"):FindFirstChild("GiftsGiven").Value += 1
			print("Finished")
		end
	end
	MPS.PromptProductPurchaseFinished:Connect(giftPurchaseFinished)
	remotes.GiftRemote.OnServerEvent:Connect(function(playerGifting, playetToGift)
		if playerGifting:FindFirstChild("OtherStats"):FindFirstChild("GiftTo") then
			local GiftToID = game.Players:GetUserIdFromNameAsync(playetToGift)
			playerGifting.OtherStats.GiftTo.Value = GiftToID
		end
	end)
end

It says this line is erroring:

local playerToGift = playerName:FindFirstChild("OtherStats"):FindFirstChild("GiftTo").Value

It says it can’t index a number with FindFirstChild, also the print isnt printing anything i dont know if thats related or not

You might try using the lua debugger to step through your code line-by-line and see that the variables are all what you expect.

I can only test this in an actual game not studio sadly, since it is gifting another player a gamepass and the player I am testing is not part of the teamcreate