0

# How to check player's leaderstats named "Points"?

So I'm making a clicker game, and I want to do ontouched event to unlock new shop, but I don't know how to check player's current leaderstats :/ ... I want to destroy the wall if success and subtract player's points. (50B)

0
opgeeza 1310
1 year ago

I assume you have already defined the player you are checking the Points for via GetPlayerFromCharacter().

After defining player, what you'd do is then use if statements to check if the Player has the correct amount of points.

local pLeaderstats = Player:FindFirstChild('leaderstats')
local points = pLeaderstats:WaitForChild('Points') -- wait for points to be in leaderstats
if points.Value >= 100 then -- check if they have x amount of points or more
-- more code here
end
end

0
Something went wrong.. Wall isn't being deleted even when I have 10 points. KoxiThePlayerPL 37 — 1y
0
did u change the "100" in abritishchap's script to something bigger or equal to 10?? Lunaify 66 — 1y
0
Edited 1 year ago

Credits to ABritishChop:

Workspace = game:GetService("Workspace")