Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

gamepass service states my gamepass isnt real?

Asked by 6 years ago
Edited 6 years ago

i did a variable stating

gamepass = game:GetService("GamePassService") if gamepass:PlayerHasPass(player,778980) then

and it would give them extra points. When I tested in Studio, it said it wasnt a gamepass and to use MarketPlaceService:PlayerOwnsAsset or something and I did it but found out it didnt do gamepasses. Help

2 answers

Log in to vote
0
Answered by 6 years ago

You have to use the new gamepass service updates they came out with

:UserOwnsGamePassAsync(player.userId, 778980)
Ad
Log in to vote
0
Answered by 6 years ago

My buddy Vissequ actually made a script post-update using the "UserOwnsGamepassAsync" function. All you have to do is edit the gamepass Id, and edit the variable outcome (what you want it to do, if it reads you own the script) Here is a copy of the script if you would like to use it:

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

local gamePassID = 0000000  -- Change this to your game pass ID 

function onPlayerSpawned(player) 

    local hasPass = false

    -- Check if the player already owns the game pass
    local success, message = pcall(function()
        hasPass = MarketplaceService:UserOwnsGamePassAsync(player.userId, gamePassID)
        print("Has Game Pass")
    end)

    -- If there's an error, issue a warning and exit the function
    if not success then
        warn("Error while checking if player has pass: " .. tostring(message))
        return
    end

    if hasPass == true then
        --On This Line, start typing what you would like it do to, in your case, the script for giving however many player points.
    end
end 

game.Players.PlayerAdded:connect(function(player)
  player.CharacterAdded:connect(function()
    onPlayerSpawned(player)
  end)
end)

-- Connect 'PlayerAdded' events to the 'onPlayerAdded()' function
Players.PlayerAdded:Connect(onPlayerSpawned)
--Script Created by Vissequ

Answer this question