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
 

Broken Script?

Previous Thread :: Next Thread 
andrei012 is not online. 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 is not online. 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 is not online. 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 is not online. 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 is not online. 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 is not online. 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 is not online. 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 is not online. 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 is not online. 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 is not online. 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
JAZZDOWN12 is not online. JAZZDOWN12
Joined: 22 Apr 2012
Total Posts: 935
08 Aug 2013 03:55 AM
hi
Report Abuse
ZachBloxx is not online. ZachBloxx
Joined: 26 Jun 2013
Total Posts: 2833
08 Aug 2013 04:05 AM
Get out.
Report Abuse
JAZZDOWN12 is not online. JAZZDOWN12
Joined: 22 Apr 2012
Total Posts: 935
08 Aug 2013 04:06 AM
no
Report Abuse
ZachBloxx is not online. ZachBloxx
Joined: 26 Jun 2013
Total Posts: 2833
08 Aug 2013 04:07 AM
yes
Report Abuse
JAZZDOWN12 is not online. JAZZDOWN12
Joined: 22 Apr 2012
Total Posts: 935
08 Aug 2013 04:28 AM
later
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