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 » Scripters
Home Search
 

Re: leaderstats/leaderboard issues

Previous Thread :: Next Thread 
sesamert16alt is not online. sesamert16alt
Joined: 08 Apr 2017
Total Posts: 81
26 Sep 2017 02:37 PM
My game has a leaderboard. If an item is added to a player's inventory, then the player's leaderstat value should go up. I have no idea how to do this, but I took a crack at it with this:
local playerLeaderstats = {}

game.Players.PlayerAdded:connect(function(player)
playerLeaderstats[player] = {}
playerLeaderstats[player]["BricksTouched"] = 0
local leaderstats = Instance.new("Model")
leaderstats.Name = "leaderstats"
leaderstats.Parent = player
local BricksTouched = Instance.new("IntValue")
BricksTouched.Name = "Bricks Touched"
BricksTouched.Value = playerLeaderstats[player]["Bricks Touched"]
BricksTouched.Parent = leaderstats
if tool.Parent == player.Backpack then
playerLeaderstats.BricksTouched.Value +1
end
end)
the leaderboard shows up fine without
if tool.Parent == player.Backpack then
playerLeaderstats.BricksTouched.Value +1
the code I made in an attempt to accomplish what I previously said, but when it is in the script, the leaderboard disappeared COMPLETELY. Why?
Report Abuse
sesamert16alt is not online. sesamert16alt
Joined: 08 Apr 2017
Total Posts: 81
26 Sep 2017 02:58 PM
bump
Report Abuse
sesamert16alt is not online. sesamert16alt
Joined: 08 Apr 2017
Total Posts: 81
26 Sep 2017 03:12 PM
bump2
Report Abuse
soutenu is online. soutenu
Joined: 09 Dec 2011
Total Posts: 1021
26 Sep 2017 03:13 PM
playerLeaderstats[player.Name] would be the proper way to use a dictionary
Report Abuse
sesamert16alt is not online. sesamert16alt
Joined: 08 Apr 2017
Total Posts: 81
26 Sep 2017 05:54 PM
Ok. I put playerLeaderstats[player.Name] in place of playerLeaderstats and it didn't do anything. Also, the plus sign in +1 is underlined in red for some reason.
helppppp
Report Abuse
sesamert16alt is not online. sesamert16alt
Joined: 08 Apr 2017
Total Posts: 81
26 Sep 2017 06:24 PM
bump.....is the forum ded today?
Report Abuse
gohan31865 is not online. gohan31865
Joined: 30 Jan 2011
Total Posts: 895
26 Sep 2017 06:28 PM
no its just that nobody wants to read through a mountain of unorganized code





without tabbing, pasting lua code is utter trash

tagging lua also makes it worse

like why do they need to get rid of our formatting, just tag out the word


#code error("you're*")
Report Abuse
sesamert16alt is not online. sesamert16alt
Joined: 08 Apr 2017
Total Posts: 81
26 Sep 2017 07:28 PM
@gohan31865 if you're not going to help on a HELP REQUEST THREAD whats the point of replying
Report Abuse
EagleFireClaw is not online. EagleFireClaw
Joined: 27 Dec 2014
Total Posts: 498
26 Sep 2017 07:46 PM
"playerLeaderstats.BricksTouched.Value +1"

um this should be pretty self explanatory why its not working..


roblox.Forum["Let's Make A Deal"]:ClearAllChildren()
Report Abuse
sesamert16alt is not online. sesamert16alt
Joined: 08 Apr 2017
Total Posts: 81
26 Sep 2017 08:03 PM
@EagleFireClaw
Not for me lol
Report Abuse
I_amCapitalT is not online. I_amCapitalT
Joined: 13 Apr 2017
Total Posts: 53
26 Sep 2017 08:44 PM
very confusing

game.Players.PlayerAdded:connect(function(player)
playerLeaderstats[player] = {}
playerLeaderstats[player]["BricksTouched"] = 0
local leaderstats = Instance.new("Model")
leaderstats.Name = "leaderstats"
leaderstats.Parent = player
local BricksTouched = Instance.new("IntValue")
BricksTouched.Name = "Bricks Touched"
BricksTouched.Value = playerLeaderstats[player]["Bricks Touched"]
BricksTouched.Parent = leaderstats
if tool.Parent == player.Backpack then
playerLeaderstats.BricksTouched.Value +1 <-- Red and error it should've been
playerleaderstats.BricksTouched.Value = playerleaderstats.BricksTouched.Value + 1 but
end
end)


print("Scripts Ya Say, I learn em. ;D")
Report Abuse
Santeeisweird9 is not online. Santeeisweird9
Joined: 15 Jan 2015
Total Posts: 735
26 Sep 2017 09:42 PM
game.Players.PlayerAdded:connect(function(player)
playerLeaderstats[player.Name] = {}
playerLeaderstats[player.Name].["BricksTouched"] = 0
local leaderstats = Instance.new("Model")
leaderstats.Name = "leaderstats"
leaderstats.Parent = player
local BricksTouched = Instance.new("IntValue")
BricksTouched.Name = "Bricks Touched"
BricksTouched.Value = playerLeaderstats[player]["Bricks Touched"]
BricksTouched.Parent = leaderstats
if tool.Parent = player.Backpack then
playerLeaderstats.BricksTouched.Value = +1
end
end)

try that?
Report Abuse
TheeDeathCaster is online. TheeDeathCaster
Joined: 19 Jun 2011
Total Posts: 1191
26 Sep 2017 09:50 PM
Line 12's the problem. >->
`playerLeaderstats.BricksTouched.Value +1`
Report Abuse
Santeeisweird9 is not online. Santeeisweird9
Joined: 15 Jan 2015
Total Posts: 735
22 Oct 2017 08:14 PM
playerLeaderstats.BricksTouched.Value = playerLeaderstats.BricksTouched.Value +1
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • 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