generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: How to check leaderboard stats?

Previous Thread :: Next Thread 
skadadlea is not online. skadadlea
Joined: 05 Oct 2010
Total Posts: 1034
10 Apr 2014 12:14 PM
for example


if [players money value] = >20 then
Report Abuse
skadadlea is not online. skadadlea
Joined: 05 Oct 2010
Total Posts: 1034
10 Apr 2014 12:18 PM
bump
Report Abuse
powertool is not online. powertool
Joined: 01 Feb 2008
Total Posts: 3771
10 Apr 2014 12:18 PM
for _,v in pairs(game.Players:GetPlayers()) do
if v:IsA("Player") then
if pcall(function()
if v.LeaderStats.Money >= 20 then
do(stuff)--Obviously I don't know what you want to do, note the do(stuff) function.
else
do(differentStuff)
end
end) then return
else return end
end
end

This should work, if it doesn't, just post here, please include a stack trace and error.

--Shira
Report Abuse
skadadlea is not online. skadadlea
Joined: 05 Oct 2010
Total Posts: 1034
10 Apr 2014 12:22 PM
will this work locally for each player?
Report Abuse
powertool is not online. powertool
Joined: 01 Feb 2008
Total Posts: 3771
10 Apr 2014 12:26 PM
It runs globally, but it iterates through each player to check their Money leaderstat. Then, depending on what the Money leaderstat is (In this case 20), it'll do either one thing, or another.

--Shira
Report Abuse
skadadlea is not online. skadadlea
Joined: 05 Oct 2010
Total Posts: 1034
10 Apr 2014 12:31 PM
here is the full script, got an error however...

script.Parent.MouseButton1Down:connect(function()
local pt = game.ReplicatedStorage.Part:Clone()
for _,v in pairs(game.Players:GetPlayers()) do
if v:IsA("Player") then
if pcall(function()
if v.LeaderStats.Money >= 20 then
pt.Parent = game.Workspace
pt.Position = game.Players.LocalPlayer.Character.HumanoidRootPart.CFrame.p + Vector3.new(0,5,0) --Places the part 5 studs above you, is that what you want?
end


error:
'end expected to close function at line 5'
Report Abuse
powertool is not online. powertool
Joined: 01 Feb 2008
Total Posts: 3771
10 Apr 2014 12:37 PM
Your script has a lot of hanging ends. I'm assuming you're plopping the money check into the GUI click that you asked about earlier, am I right? Try this. (Oh, and if at all possible, please thank me in the description for helping you debug or something, much appreciated.)

script.Parent.MouseButton1Down:connect(function()
for _,v in pairs(game.Players:GetPlayers()) do
if v:IsA("Player") then
if pcall(function()
if v.LeaderStats.Money >= 20 then
local pt = game.ServerStorage.Part:Clone()
pt.Parent = game.Workspace
pt.Position = game.Players.LocalPlayer.Character.HumanoidRootPart.CFrame.p + Vector3.new(0,5,0) --Places the part 5 studs above you, is that what you want?
else return end
end) then return
else return end
end
end
end)

--Shira



Report Abuse
skadadlea is not online. skadadlea
Joined: 05 Oct 2010
Total Posts: 1034
10 Apr 2014 12:53 PM
yes you are right. Unfortunately it is not doing anything, and nothing is coming up in output relevant to the script.
Report Abuse
skadadlea is not online. skadadlea
Joined: 05 Oct 2010
Total Posts: 1034
10 Apr 2014 12:53 PM
also I would be happy to credit you
Report Abuse
skadadlea is not online. skadadlea
Joined: 05 Oct 2010
Total Posts: 1034
10 Apr 2014 01:00 PM
help
Report Abuse
powertool is not online. powertool
Joined: 01 Feb 2008
Total Posts: 3771
10 Apr 2014 01:23 PM
Do you have more than 20 money? Then it should work. I didn't spam my script full of debug lines, which I normally do.
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image