local function giftHandler()
local function giftPurchaseFinished(player, purchaseID, status)
if status == true then
print(player)
local playerName = game.Players:GetPlayerByUserId(player)
print(playerName.Name)
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
playerName: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 because it cant index a number with FindFirstChild
local playerToGift = playerName:FindFirstChild("OtherStats"):FindFirstChild("GiftTo").Value
Also the prints arent working in that either