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