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)
COMMUNITY QUESTION
How to check player's leaderstats named "Points"?
2 answers
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')
if pLeaderstats then -- check if player has leaderstats yet
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
Credits to ABritishChop:
Workspace = game:GetService("Workspace")
local pLeaderstats = Player:FindFirstChild('leaderstats')
if pLeaderstats then -- check if player has leaderstats yet
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
Workspace:WaitForChild("Wall").CanCollide = false
Workspace:WaitForChild("Wall").Transparency = 1
end
end
change the path of "Wall" to the part of your wall
This discussion is preserved as it was. New answers, comments, and votes are closed.

2 comments
Something went wrong.. Wall isn't being deleted even when I have 10 points.
did u change the "100" in abritishchap's script to something bigger or equal to 10??