andrei012
|
  |
| Joined: 05 Nov 2010 |
| Total Posts: 279 |
|
|
| 08 Aug 2013 03:01 AM |
game.Players.PlayerAdded:connect(function(player) local leaderstats = Instance.new("Model", player) leaderstats.Name = "leaderstats" Tool = Instance.new("StringValue", leaderstats) Tool.Name = "Holding" Tool.Value = "None" player.Backpack.GetChildren:connect(function(Tools) -- i think i messed up here, idk how to use GetChildren Tools.Selected:connect(function(onSelected) Tool.Value = Tools end) end) end)
Here's the Idea: So a there is a leader board and a Stat inside it called "Holding" I want it so player can see what another player are holding.... |
|
|
| Report Abuse |
|
|
ZachBloxx
|
  |
| Joined: 26 Jun 2013 |
| Total Posts: 2833 |
|
|
| 08 Aug 2013 03:03 AM |
game.Players.PlayerAdded:connect(function(player) local leaderstats = Instance.new("IntValue", player) leaderstats.Name = "leaderstats" Tool = Instance.new("StringValue", leaderstats) Tool.Name = "Holding" Tool.Value = "None" end)
-- Now in your tool put a line in to change the stat value to the tool name. |
|
|
| Report Abuse |
|
|
andrei012
|
  |
| Joined: 05 Nov 2010 |
| Total Posts: 279 |
|
|
| 08 Aug 2013 03:07 AM |
Umm... this?
player.Backpack.GetChildren:connect(function(Tools) -- i think i messed up here, idk how to use GetChildren Tools.Selected:connect(function(onSelected) Tool.Value = Tools |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 08 Aug 2013 03:08 AM |
| You did mess up there, GetChildren returns a table of all the decedents of an object |
|
|
| Report Abuse |
|
|
andrei012
|
  |
| Joined: 05 Nov 2010 |
| Total Posts: 279 |
|
|
| 08 Aug 2013 03:09 AM |
I also tried this but it didnt work either
game.Players.PlayerAdded:connect(function(player) local leaderstats = Instance.new("Model", player) leaderstats.Name = "leaderstats" local Tool = Instance.new("StringValue", leaderstats) Tool.Name = "Holding" Tool.Value = "None" player.CharacterAdded:connect(function(Character) Character.ChildAdded:connect(function(Child) Tool.Value = Child end) end) end) |
|
|
| Report Abuse |
|
|
ZachBloxx
|
  |
| Joined: 26 Jun 2013 |
| Total Posts: 2833 |
|
|
| 08 Aug 2013 03:10 AM |
Put this some where in your tool:
myPlayer.leaderstats.Holding.Value = script.Parent.Name
-- You must define myPlayer though. |
|
|
| Report Abuse |
|
|
ZachBloxx
|
  |
| Joined: 26 Jun 2013 |
| Total Posts: 2833 |
|
|
| 08 Aug 2013 03:11 AM |
player.CharacterAdded:connect(function(Character) Character.ChildAdded:connect(function(Child) if Child:IsA("Tool") then player.leaderstats.Holding.Value = Child.Name end) end) end) |
|
|
| Report Abuse |
|
|
andrei012
|
  |
| Joined: 05 Nov 2010 |
| Total Posts: 279 |
|
|
| 08 Aug 2013 03:15 AM |
Like this?
game.Players.PlayerAdded:connect(function(player) local leaderstats = Instance.new("Model", player) leaderstats.Name = "leaderstats" local Tool = Instance.new("StringValue", leaderstats) Tool.Name = "Holding" Tool.Value = "None" player.CharacterAdded:connect(function(Character) Character.ChildAdded:connect(function(Child) if Child:IsA("Tool") then player.leaderstats.Holding.Value = Child.Name end end) end) end) |
|
|
| Report Abuse |
|
|
ZachBloxx
|
  |
| Joined: 26 Jun 2013 |
| Total Posts: 2833 |
|
|
| 08 Aug 2013 03:16 AM |
| Make leaderstats an IntValue. Other than that it's fine. |
|
|
| Report Abuse |
|
|
andrei012
|
  |
| Joined: 05 Nov 2010 |
| Total Posts: 279 |
|
|
| 08 Aug 2013 03:18 AM |
It works but, Tools without Handles doesnt show up! but its ok i can add handles
Thanks! |
|
|
| Report Abuse |
|
|
| |
|
ZachBloxx
|
  |
| Joined: 26 Jun 2013 |
| Total Posts: 2833 |
|
| |
|
| |
|
ZachBloxx
|
  |
| Joined: 26 Jun 2013 |
| Total Posts: 2833 |
|
| |
|
| |
|