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: it broke -_-

Previous Thread :: Next Thread 
Excession is not online. Excession
Joined: 09 Sep 2011
Total Posts: 2674
20 Aug 2014 03:25 PM
This snippet of code was working perfectly untill today:

game.Players.PlayerAdded:connect(function (player)

-- Set up money
stats = Instance.new("IntValue")
stats.Name = "leaderstats"
stats.Parent = player
money = Instance.new("IntValue")
money.Name = "Money"
money.Value = 100 -- starter money yo
money.Parent = stats

end)

What is wrong? For some players it does not create the money stat (I checked the developer console and it said that leaderstats do not exist)
Report Abuse
Krypticon is not online. Krypticon
Joined: 12 Feb 2014
Total Posts: 680
20 Aug 2014 03:29 PM
Try this?

Game.Players.PlayerAdded:connect(function(player)
local stats,money=Instance.new("IntValue",player),Instance.new("IntValue")
stats.Name="leaderstats"
money.Parent=stats
money.Name="Money"
money.Value=100
end)

Should work.

:)
Report Abuse
MrCherrys is not online. MrCherrys
Joined: 28 Apr 2010
Total Posts: 13469
20 Aug 2014 03:32 PM
Do this the other way.

Get an Integer Value (IntValue), place it inside 'Script' and name the Interger Value 'leaderstats'. Get another Integer Value and place it inside 'leaderstats' and name it 'Money'.

Then put this into your script.

game.Players.PlayerAdded:connect(function(player)
for _,v in pairs (script:GetChildren()) do
v:Clone().Parent = p
end
end)
Report Abuse
islandmaker2012 is not online. islandmaker2012
Joined: 07 Nov 2012
Total Posts: 9327
20 Aug 2014 03:33 PM
@OP

in your code that adds/removes/checks the stats, use WaitForChild, so that it makes sure its already there
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