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