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

Why wont my gamepass item giver give an item?

I'm trying to make a script that gives a player an item if they have purchased the gamepass. The game is in Filtering Enabled by the way.

gpid = (4676621) 
tools = {"Flashlight"}
GPS = game:GetService("GamePassService")

function respawned(char)
player = game.Players:FindFirstChild(char.Name)
print("Respawned")
if char:FindFirstChild("Head") ~= nil then
print("It's a Player!")
if GPS:PlayerHasPass(player, gpid) then
print("Has GPID")
for i = 1,#tools do
game.Lighting:FindFirstChild(tools[i]):Clone().Parent = player.Backpack
end
end
end
end
game.Workspace.ChildAdded:connect(respawned)

I'm a bit of a noob, so please go easy on me!

2 comments

0

Stop using the “I’m a bit of a noob, so please go easy on me!" It just asks for people to go hard, and you’ve used that for months.

0

I'm just informing people no need to be rude.. :I

1 answer

Don't use GamePassService, instead use MarketplaceService

if game:GetService("MarketplaceService"):UserOwnsGamePassAsync(player.userId,gpid) then

The first argument is the player's user ID, and the second is the gamepass ID

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