|
| 17 May 2016 10:00 PM |
Whenever I go to play the actual game ( not testing ) my leaderboard dosen't show up. This is the script:
game.Players.PlayerAdded:connect(function(plr) local stats = Instance.new('IntValue', plr) stats.Name = 'leaderstats' local doritos = Instance.new('IntValue', stats) doritos.Name = 'Doritos' local dps = Instance.new('IntValue', stats) dps.Name = 'DPS' end)
I don't know why this is happening, and would appreciate some help. Thanks. |
|
|
| Report Abuse |
|
|
Salinas23
|
  |
| Joined: 28 Dec 2008 |
| Total Posts: 37141 |
|
|
| 17 May 2016 10:08 PM |
*After reading for 18 seconds on wiki*
"1) To make a leaderboard, start by inserting an object named 'leaderstats' into each player. This should be a Model or a Folder. If you use a *Value object, like an IntValue or StringValue, this may not work)."
there is your answer |
|
|
| Report Abuse |
|
|
Wowgnomes
|
  |
| Joined: 27 Sep 2009 |
| Total Posts: 26255 |
|
|
| 17 May 2016 10:09 PM |
| I've used an IntValue before and just more intvalues inside it and that has worked for me in the past |
|
|
| Report Abuse |
|
|
Wowgnomes
|
  |
| Joined: 27 Sep 2009 |
| Total Posts: 26255 |
|
|
| 17 May 2016 10:10 PM |
game.Players.PlayerAdded:connect(function(plr) local stats = Instance.new('IntValue', plr) stats.Name = 'leaderstats' stats.Parent = plr local doritos = Instance.new('IntValue', stats) doritos.Name = 'Doritos' doritos.Parent = stats local dps = Instance.new('IntValue', stats) dps.Name = 'DPS' dps.Parent = plr end)
|
|
|
| Report Abuse |
|
|
Wowgnomes
|
  |
| Joined: 27 Sep 2009 |
| Total Posts: 26255 |
|
|
| 17 May 2016 10:11 PM |
but u can also do
game.Players.PlayerAdded:connect(function(plr) local gnome = Instance.new('IntValue', plr) gnome.Name = 'leaderstats' gnome.Parent = plr local gnome = Instance.new('IntValue', stats) gnome.Name = "Doritos" gnome.Parent = stats local gnome = Instance.new('IntValue', stats) gnome.Name = "DPS" gnome.Parent = plr end)
does not matter to me |
|
|
| Report Abuse |
|
|
|
| 17 May 2016 10:36 PM |
| You cannot use an IntValue because I don't know. I tried using an IntValue as a container for the leaderboard and bam, it didn't work. |
|
|
| Report Abuse |
|
|
|
| 18 May 2016 04:30 PM |
Now the leaderboard is appearing, but not adding value to the leaderboard when a gui is clicked.
script.Parent.MouseButton1Click:connect(function() local d = game.Players.LocalPlayer.leaderstats.Doritos d.Value = (d.Value + 1) end) |
|
|
| Report Abuse |
|
|
Wowgnomes
|
  |
| Joined: 27 Sep 2009 |
| Total Posts: 26255 |
|
|
| 18 May 2016 05:21 PM |
script.Parent.MouseButton1Click:connect(function(player) print("Click'd") local d = player:findFirstChild("leaderstats") local db = d.Doritos db.Value = (db.Value + 1) end)
|
|
|
| Report Abuse |
|
|
|
| 18 May 2016 07:04 PM |
| 19:03:38.041 - Players.Player1.PlayerGui.Screen.BG.DoritoBG.ImageButton.GiveDoritos:2: attempt to index local 'plr' (a nil value) |
|
|
| Report Abuse |
|
|
lululukas
|
  |
| Joined: 23 Aug 2010 |
| Total Posts: 1043 |
|
|
| 18 May 2016 07:08 PM |
You used plr instead of player
That is if you're using his script. |
|
|
| Report Abuse |
|
|
|
| 18 May 2016 08:04 PM |
| It happened the same for player |
|
|
| Report Abuse |
|
|
Wowgnomes
|
  |
| Joined: 27 Sep 2009 |
| Total Posts: 26255 |
|
| |
|
|
| 18 May 2016 08:38 PM |
(PlayerAdded script)
game.Players.PlayerAdded:connect(function(plr) local stats = Instance.new('IntValue', plr) stats.Name = 'leaderstats' stats.Parent = plr local doritos = Instance.new('IntValue', stats) doritos.Name = 'Doritos' doritos.Parent = stats local dps = Instance.new('IntValue', stats) dps.Name = 'DPS' dps.Parent = stats end)
(Give Doritos script)
script.Parent.MouseButton1Click:connect(function(plr) local d = plr:FindFirstChild('leaderstats') local dr = d.Doritos dr.Value = (dr.Value + 1) end)
(Error)
20:38:22.383 - Players.Player1.PlayerGui.Screen.BG.DoritoBG.ImageButton.GiveDoritos:2: attempt to index local 'plr' (a nil value) |
|
|
| Report Abuse |
|
|
| |
|
|
| 18 May 2016 09:28 PM |
| MouseButton1Click and MouseButton1Down don't return the player. Assuming that this is a server script, you need to just use a local script for the GUI. |
|
|
| Report Abuse |
|
|