Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

My weapon giver from gamepass doesn't work?

local player = game.Players.LocalPlayer
local m = game:GetService('MarketplaceService')
local id = 5552577

player.CharacterAdded:Connect(function(char)
    if m:UserOwnsGamePassAsync(player, id) then
         game.ReplicatedStorage.VIPGun:Clone().Parent = char.Backpack
    end
end)

1 answer

✓ Accepted answer

The first argument is supposed to be a userId, not a player object:

local player = game.Players.LocalPlayer
local m = game:GetService('MarketplaceService')
local id = 5552577

player.CharacterAdded:Connect(function(char)
    if m:UserOwnsGamePassAsync(player.UserId, id) then
         game.ReplicatedStorage.VIPGun:Clone().Parent = char.Backpack
    end
end)

This discussion is preserved as it was. New answers, comments, and votes are closed.