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

How do i make it so it detects gamepasses?

Asked by 2 years ago

I have a donation game but it says that i dont own the gamepass (I mean like made it) but here is the code

script.Parent.MouseButton1Click:Connect(function()
    local text = script.Parent.Parent.Text

    local success, err = pcall(function()
        script.Value.Value = game.MarketplaceService:GetProductInfo(text).Pr
    end)

    if success then
        if game.MarketplaceService:GetProductInfo(text).Creator.Name == game.Players.LocalPlayer.Name then
            game.ReplicatedStorage.Edit:FireServer(script.Parent.Parent.Name, script.Parent.Parent.Text)
        else
            script.Parent.Parent.Parent.Parent.TextLabel.Text = "Make sure you created the item you are submitting!"
            wait(2)
            script.Parent.Parent.Parent.Parent.TextLabel.Text = ""
        end
    else
        script.Parent.Parent.Parent.Parent.TextLabel.Text = "ID isn't valid!"
        wait(2)
        script.Parent.Parent.Parent.Parent.TextLabel.Text = ""
    end
end)

1 answer

Log in to vote
0
Answered by
KingDomas 153
2 years ago
Edited 2 years ago

You haven't put an id in? Here's a script for checking if you own a gamepass:

local id = --Type your gamepass id here.

game.Players.PlayerAdded:Connect(function(plr)
  if game:GetService("MarketplaceService"):UserOwnsGamePassAsync(
plr.UserId,id) then --checks if player owns gamepass
--Gamepass function here, such as giving VIP.
end)
Ad

Answer this question