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

Error on this gamepass checking script, is not a valid member of player Help me?

Asked by 5 years ago
local owns = game:GetService("MarketplaceService"):PlayerOwnsAsset(game.Players[script.Parent.Parent.UsernameInput.Text].UserId, 1107385689)

script.Parent.MouseButton1Click:Connect(function()
    if owns then
        script.Parent.Parent.GPStatus.Text = "Gamepass Status: User has the Suite gamepass"
        wait(3)
        script.Parent.Parent.GPStatus.Text = "Gamepass Status: N/A"
    else
        script.Parent.Parent.GPStatus.Text = "Gamepass Status: User doesn't have the suite gamepass."
        wait(3)
        script.Parent.Parent.GPStatus.Text = "Gamepass Status: N/A"
    end
end)


these few days there has been something wrong with my scripting skills and i cant think straight help me?

0
paste the whole error please hellmatic 1523 — 5y
0
What waifuSZN 123 — 5y

1 answer

Log in to vote
1
Answered by 5 years ago

Game passes are no longer assets. They are their own ID, formatted like this:

https://www.roblox.com/game-pass/idhere/passnamehere

A fix is to use the UserOwnsGamePassAsync method.

local player = game:GetService("Players").LocalPlayer
local owns = game:GetService("MarketplaceService"):UserOwnsGamePassAsync(game.Players[script.Parent.Parent.UsernameInput.Text].UserId, 1107385689)

script.Parent.Activated:Connect(function(inputObject)
    if owns then
        script.Parent.Parent.GPStatus.Text = "Gamepass Status: User has the Suite gamepass"
        wait(3)
        script.Parent.Parent.GPStatus.Text = "Gamepass Status: N/A"
    else
        script.Parent.Parent.GPStatus.Text = "Gamepass Status: User doesn't have the suite gamepass."
        wait(3)
        script.Parent.Parent.GPStatus.Text = "Gamepass Status: N/A"
    end
end)



1
Thanks! I'm guessing roblox just made this recently since I took a few months break. What a time waster, anyways thanks! DaWarTekWizard 169 — 5y
Ad

Answer this question