Hello, so I have this script I want to give an item to my friend but it doesnt let me.
local function onPromptPurchaseFinished(player, gamepassId, purchaseSuccess)
if purchaseSuccess or player.UserId == 300127038 then
for _, v in gamepassTools do
if v.ID == gamepassId then
local tool1 = tools[v.Name]:Clone()
tool1.Parent = player.Backpack
local tool2 = tools[v.Name]:Clone()
tool2.Parent = player.StarterGear
LimitedFrame.Enabled = false
end
end
end
end
I assume you’re calling this function when the prompt finished, so if you want your friend to also get this tool, one way to do it is to call the function when you want the tool to be given to the player with the arguments it should contain: onPromptPurchasedFinished(player, gamepassId) and another and better way to do it would be to make a separate function which gives an item to a player and use it when you want the player to get it, for such a case you should have a command to do it and not have it stick in the code forever just for that one player, seeing what you’ve provided it doesn’t look like you’re saving the data, which is not good for gamepasses, all your script currently does is it will give the item temporarily until the player dies, with data saving and player.CharacterAdded, you will be able to save this issue