#Doesn't give item in game

1 messages · Page 1 of 1 (latest)

pseudo salmon
#

Hi, I made this script for a part that when touched, prompts a ''Magic Carpet'' gamepass if not owned, if the gamepass is owned then the item is given automatically when the player joins the game, my issue is, it works inside Roblox Studo but not the actual game

script used to give item in game if owned

''local Players = game:GetService("Players")
local MarketplaceService = game:GetService("MarketplaceService")
local InsertService = game:GetService("InsertService")

local GAMEPASS_ID = 1384533590
local ASSET_ID = 225921000 -- Replace with your item asset ID

Players.PlayerAdded:Connect(function(player)
local success, ownsPass = pcall(function()
return MarketplaceService:UserOwnsGamePassAsync(player.UserId, GAMEPASS_ID)
end)

if success and ownsPass then
    local asset = InsertService:LoadAsset(ASSET_ID)
    local tool = asset:FindFirstChildOfClass("Tool")
    if tool then
        tool.Parent = player:WaitForChild("Backpack")
    end
end

end)''

script used to prompt the gamepass if gamepass isn't owned

''local MarketplaceService = game:GetService("MarketplaceService")
local Players = game:GetService("Players")

local GAMEPASS_ID = 1384533590

script.Parent.Touched:Connect(function(hit)
local player = Players:GetPlayerFromCharacter(hit.Parent)
if player then
MarketplaceService:PromptGamePassPurchase(player, GAMEPASS_ID)
end
end)
''

hollow sentinel
#

did you really make this script?

#

last i checked, another person and/or ai and/or tutorials are not you, i could be wrong though and you are a robot. the ai uprising is happening agony

pseudo salmon
#

i made some parts of it 😭 im kinda new to scripting

#

WAIT i know why it doesnt work

#

nvm