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

UserID is not a valid member of Player. How do i fix this?

local function onMouseClick(player) local Points = player.leaderstats.Points

if game:GetService("MarketplaceService"):UserOwnsGamePassAsync(player.UserID,000000) then Points.Value = Points.Value + 250 else print("Player doesnt have gamepass") end end

script.Parent.ClickDetector.MouseClick:connect(onMouseClick)

1 comment

0

it's player.UserId lowercase on the d

1 answer

It's A Very Simple Error, and a mistake the best of us make. You added a capital where a capital shouldn't be xD. It's "UserId" not "UserID"

Here's Your Script Rewritten:

local function onMouseClick(player) local Points = player.leaderstats.Points

if game:GetService("MarketplaceService"):UserOwnsGamePassAsync(player.UserId,000000) then Points.Value = Points.Value + 250 else print("Player doesnt have gamepass") end end

script.Parent.ClickDetector.MouseClick:connect(onMouseClick)

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