I have a script that when it detects you have a certain gamepass takes the item from server storage and places it in your backpack. The script works in other games but not this one and I am really confused. Any help appreciated.
local MarketPlaceService = game:GetService(“MarketplaceService”)
local GamepassId = 15090522
local Tool = game.ServerStorage[“GoldenBoomBox”]
if MarketPlaceService:UserOwnsGamePassAsync(Player.UserId, GamepassId) then
local ToolClone = Tool:Clone()
ToolClone.Parent = Player.Backpack
I feel like you may need to turn this on if possible, also check if the Tool is equal to where it actually is
Are you using an alt account? Cause there’s someone else who asked for the exact same thing.
No i’m not, idk what is going on
local Tool = game.ServerStorage["GoldenBoomBox"]
local Tool = game.ServerStorage:WaitForChild("GoldenBoomBox")
Still no luck, there’s no output either
I added pcall for security reasons, otherwise, this code definitely works. Try printing out hasGamePass value. Are you sure you own a gamepass? Is the gamepass ID correct? Make sure that the script (server script) is located in ServerScriptService (I accidentally put it inside ServerStorage at first ). Third party sales can be disabled and character is also already loaded by the time tool is copied.
local MarketPlaceService = game:GetService("MarketplaceService")
local GAMEPASS_ID = 15090522
-- correct path required
local tool = game:GetService("ServerStorage")["Golden Boom Box"]
local hasGamePass; local success, err = pcall(function()
hasGamePass = MarketPlaceService:UserOwnsGamePassAsync(player.UserId, GAMEPASS_ID)
if (not success) then
warn("Something went wrong while trying to access user's gamepass data.")
if (hasGamePass) then tool:Clone().Parent = player.Backpack end