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

Gamepass checker not working, how do I fix this and why is it happening?

This script is meant to make it so that if you own the gamepass; you will receive a Desert Eagle (The guns are set up correctly).

When the server starts up; there is no erro in output; but I do not receive a tool?

local id = 15372682

local function checkOwnership(plr)
	return game:GetService('MarketplaceService'):PlayerOwnsAsset(plr, id)
end

function tool(plr)
	local gun = game.ServerStorage["Desert Eagle"]:Clone()
	gun.Parent = plr.Backpack
end

game.Players.PlayerAdded:Connect(function(plr)
	if checkOwnership(plr) then
		tool(plr)
	end
end)

8 comments

0

Do you actually own the gamepass? The script looks good

0

oh im stupid

0

oh im stupid

0

Wait; no; it doesn't work even with owning the pass?

0

Is it because you forgot local in front of the second function? Also make sure you have the right id :P

0

Nope still doesn't work

0

just use gamepass door free model

0

or use value

1 answer

You are using MarketplaceService:PlayerOwnsAsset()

For game passes, you should use MarketplaceService:UserOwnsGamePassAsync()


local id = 15372682

local function checkOwnership(plr)
    return game:GetService('MarketplaceService'):UserOwnsGamePassAsync(plr.UserId, id)
end

function tool(plr)
    local gun = game.ServerStorage["Desert Eagle"]:Clone()
    gun.Parent = plr.Backpack
end

game.Players.PlayerAdded:Connect(function(plr)
    if checkOwnership(plr) then
        tool(plr)
    end
end)

3 comments

0

On line 4 it outputs 'unable to cast Instance to int64'

0

I fixed it sorry

0

still doesn't work- no error in output

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