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

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

Asked by
MAKKU 37
6 years ago

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)

0
it's `player.UserId` lowercase on the `d` theCJarmy7 1293 — 6y

1 answer

Log in to vote
1
Answered by 6 years ago

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)
Ad

Answer this question