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: Points leaderboard.

Previous Thread :: Next Thread 
talk2me2 is not online. talk2me2
Joined: 25 Mar 2011
Total Posts: 1051
20 Nov 2013 12:06 PM
I am not sure what is going wrong exactly, but I know it is the last part, and the first part of the script. The script is meant to give the player 5k points if they have VIP1, 20k if they have VIP2, and 25k if they have both VIPS each time they join. Also, if you have VIP1, you get +5 points a second, VIP2 gives you +20 points a second, and both VIPs give you +25 a second.
It also saves/loads.

wait()
vippassid1 = 133197742
vippassid2 = 133204602
add = 5000
add2 = 20000
addboth = 25000

game.Players.PlayerAdded:connect(function(plr)
plr:WaitForDataReady()
local stats = Instance.new("IntValue", plr)
stats.Name = "leaderstats"
local pts = Instance.new("IntValue", stats)
pts.Name = "Points"
pts.Value = plr:LoadNumber("Pts")
if (game:GetService("BadgeService"):UserHasBadge(plr.userId, vippassid1) and game:GetService("BadgeService"):UserHasBadge(plr.userId, vippassid2)) then
pts.Value = pts.Value + addboth
elseif game:GetService("BadgeService"):UserHasBadge(plr.userId, vippassid1) then
pts.Value = pts.Value + add
elseif game:GetService("BadgeService"):UserHasBadge(plr.userId, vippassid2) then
pts.Value = pts.Value + add2
end
pts.Changed:connect(function()
plr:SaveNumber("Pts", pts.Value)
end)
Spawn(function()
while wait(1) do
if (game:GetService("BadgeService"):UserHasBadge(ply.userId, vippassid1) and game:GetService("BadgeService"):UserHasBadge(ply.userId, vippassid2)) then
pts.Value = pts.Value + 25
elseif game:GetService("BadgeService"):UserHasBadge(ply.userId, vippassid2) then
pts.Value = pts.Value + 20
elseif game:GetService("BadgeService"):UserHasBadge(ply.userId, vippassid1) then
pts.Value = pts.Value + 5
end
if not (game:GetService("BadgeService"):UserHasBadge(ply.userId, vippassid1) or game:GetService("BadgeService"):UserHasBadge(ply.userId, vippassid2)) then
pts.Value = pts.Value + 1
end
end
end)
end)
Report Abuse
flatline115 is not online. flatline115
Joined: 29 Jul 2013
Total Posts: 7826
20 Nov 2013 12:07 PM
I do not have the patients to read this so what line errors?
Report Abuse
talk2me2 is not online. talk2me2
Joined: 25 Mar 2011
Total Posts: 1051
20 Nov 2013 12:08 PM
PlayerAdded doesn't function in play solo, sorry.
Report Abuse
flatline115 is not online. flatline115
Joined: 29 Jul 2013
Total Posts: 7826
20 Nov 2013 12:10 PM
I know, that is why you use Start Server/Player
Report Abuse
talk2me2 is not online. talk2me2
Joined: 25 Mar 2011
Total Posts: 1051
20 Nov 2013 12:14 PM
It doesn't function in that either.

Unless it is me.
Report Abuse
flatline115 is not online. flatline115
Joined: 29 Jul 2013
Total Posts: 7826
20 Nov 2013 12:15 PM
No output in there?
Report Abuse
flatline115 is not online. flatline115
Joined: 29 Jul 2013
Total Posts: 7826
20 Nov 2013 12:16 PM
If there is nil output use prints after every line and tell what line it stops on.
Report Abuse
talk2me2 is not online. talk2me2
Joined: 25 Mar 2011
Total Posts: 1051
20 Nov 2013 12:22 PM
Printed something on every line, nothing showed.
Weird.

wait()
vippassid1 = 133197742
vippassid2 = 133204602
add = 5000
add2 = 20000
addboth = 25000
print("START")
game.Players.PlayerAdded:connect(function(plr)
print("1")
plr:WaitForDataReady()
print("2")
local stats = Instance.new("IntValue", plr)
print("3")
stats.Name = "leaderstats"
print("4")
local pts = Instance.new("IntValue", stats)
print("5")
pts.Name = "Points"
print("6")
pts.Value = plr:LoadNumber("Pts")
print("7")
if (game:GetService("BadgeService"):UserHasBadge(plr.userId, vippassid1) and game:GetService("BadgeService"):UserHasBadge(plr.userId, vippassid2)) then
print("both passes")
pts.Value = pts.Value + addboth
elseif game:GetService("BadgeService"):UserHasBadge(plr.userId, vippassid1) then
print("vip 1")
pts.Value = pts.Value + add
elseif game:GetService("BadgeService"):UserHasBadge(plr.userId, vippassid2) then
print("vip 2")
pts.Value = pts.Value + add2
end
print("8")
pts.Changed:connect(function()
print("9")
plr:SaveNumber("Pts", pts.Value)
end)
print("10")
Spawn(function()
print("11")
while wait(1) do
print("12")
if (game:GetService("BadgeService"):UserHasBadge(ply.userId, vippassid1) and game:GetService("BadgeService"):UserHasBadge(ply.userId, vippassid2)) then
print("13")
pts.Value = pts.Value + 25
elseif game:GetService("BadgeService"):UserHasBadge(ply.userId, vippassid2) then
print("14")
pts.Value = pts.Value + 20
elseif game:GetService("BadgeService"):UserHasBadge(ply.userId, vippassid1) then
print("15")
pts.Value = pts.Value + 5
end
if not (game:GetService("BadgeService"):UserHasBadge(ply.userId, vippassid1) or game:GetService("BadgeService"):UserHasBadge(ply.userId, vippassid2)) then
print("16")
pts.Value = pts.Value + 1
end
end
end)
end)
print("Ended")
Report Abuse
flatline115 is not online. flatline115
Joined: 29 Jul 2013
Total Posts: 7826
20 Nov 2013 12:24 PM
? I don't understand.. Then there is no error in your script.
Report Abuse
talk2me2 is not online. talk2me2
Joined: 25 Mar 2011
Total Posts: 1051
20 Nov 2013 12:25 PM
Something weird here... The first/last bits do not work...
Report Abuse
smiley599 is not online. smiley599
Joined: 23 Jan 2010
Total Posts: 21869
20 Nov 2013 12:52 PM
Where is the script located?

Make sure it's not disabled.
Report Abuse
talk2me2 is not online. talk2me2
Joined: 25 Mar 2011
Total Posts: 1051
20 Nov 2013 01:44 PM
Not disabled, and it is located in the Workspace. Straight in there, not in a part.
Report Abuse
talk2me2 is not online. talk2me2
Joined: 25 Mar 2011
Total Posts: 1051
20 Nov 2013 02:19 PM
Bump.
Report Abuse
einsteinK is not online. einsteinK
Joined: 22 May 2011
Total Posts: 1015
20 Nov 2013 02:21 PM
No localscript I hope?
Report Abuse
talk2me2 is not online. talk2me2
Joined: 25 Mar 2011
Total Posts: 1051
20 Nov 2013 02:32 PM
Nope.
Report Abuse
talk2me2 is not online. talk2me2
Joined: 25 Mar 2011
Total Posts: 1051
20 Nov 2013 03:03 PM
Bump
Report Abuse
talk2me2 is not online. talk2me2
Joined: 25 Mar 2011
Total Posts: 1051
20 Nov 2013 05:06 PM
Bump.
Report Abuse
talk2me2 is not online. talk2me2
Joined: 25 Mar 2011
Total Posts: 1051
21 Nov 2013 01:17 AM
BUMPer cars.
Report Abuse
M39a9am3R is not online. M39a9am3R
Joined: 10 Nov 2012
Total Posts: 1933
21 Nov 2013 06:11 AM
I don't think he defined the parent of the leaderstats values. If the error is they are not showing up then that's why. So you would want the leaderstats value to have the parent of the new player, and the points to be the child of leaderstats.
Report Abuse
talk2me2 is not online. talk2me2
Joined: 25 Mar 2011
Total Posts: 1051
21 Nov 2013 10:59 AM
I did. You can parent objects by using a second argument.

local stats = Instance.new("IntValue", plr) --Look.
stats.Name = "leaderstats"
local pts = Instance.new("IntValue", stats)
pts.Name = "Points"
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