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: Help with Stats!

Previous Thread :: Next Thread 
Epicgamerz0 is not online. Epicgamerz0
Joined: 25 Feb 2015
Total Posts: 45
27 Feb 2016 04:59 PM
So, I created a stat in my game. While I was testing, I joined a new team and the stat disappeared! Now whenever I rejoin the game, the stat won't show up! How do I fix this? This is my code:

function onPlayerEntered (plr)
local stats = Instance.new("IntValue")
stats.Name = "leaderstats"

local Money = Instance.new("IntValue")
Money.Name = "Money"
Money.Value = 0

Money.Parent = stats
stats.Parent = newPlayer
end

game.Players.ChildAdded:connect(onPlayerEntered)



while wait(60) do
for i,v in pairs(game.Players:GetPlayers()) do
if v.TeamColor == BrickColor.new("Shamrock" "Quill grey" "Buttermilk" "Magenta" "CGA brown" "Cocoa" 'Gold" "Lime green" "Bronze" "Lily white" "Crimson" "Earth green" "Maroon" "Forest green" "Bright bluish green" "Bright blue" "New Yeller" "Br. yellowish green") then --Change the BrickColor To Whatever
v.leaderstats.Money.Value = v.leaderstats.Money.Value + 30
end
end
end

Report Abuse
Epicgamerz0 is not online. Epicgamerz0
Joined: 25 Feb 2015
Total Posts: 45
27 Feb 2016 06:34 PM
Bump
Report Abuse
RPG_Dev is not online. RPG_Dev
Joined: 19 Nov 2011
Total Posts: 419
27 Feb 2016 06:38 PM
Did you get any errors?


Report Abuse
Epicgamerz0 is not online. Epicgamerz0
Joined: 25 Feb 2015
Total Posts: 45
27 Feb 2016 06:45 PM
None. I just spawn and its not there.
Report Abuse
kingkiller1000 is not online. kingkiller1000
Joined: 12 Dec 2008
Total Posts: 26415
27 Feb 2016 06:49 PM
> stats.Parent = newPlayer

Should be

stats.Parent = plr


Also, replace the bottom section with this:

local colors = {"Shamrock","Quill grey","Buttermilk","Magenta","CGA brown","Cocoa","Gold", "Lime green", "Bronze", "Lily white", "Crimson", "Earth green", "Maroon", "Forest green", "Bright bluish green", "Bright blue", "New Yeller", "Br. yellowish green"}
while wait(60) do
for i,v in pairs(game.Players:GetPlayers() do
for x, color in pairs(colors) do
if v.TeamColor == BrickColor.new(color) then
v.leaderstats.Money.Value = v.leaderstats.Money.Value + 30
end
end
end

I really hope you actually need all those team colors and aren't just trying to get everyone
Report Abuse
Epicgamerz0 is not online. Epicgamerz0
Joined: 25 Feb 2015
Total Posts: 45
27 Feb 2016 06:59 PM
It still doesn't work with that new code. The output keeps givng me some mumbo jumbo about putting a '}' year the "Quill grey".
Report Abuse
Epicgamerz0 is not online. Epicgamerz0
Joined: 25 Feb 2015
Total Posts: 45
27 Feb 2016 07:07 PM
*near
Report Abuse
kingkiller1000 is not online. kingkiller1000
Joined: 12 Dec 2008
Total Posts: 26415
27 Feb 2016 07:08 PM
I don't know why it would say that; it looks fine to me. Post the current code you have.
Report Abuse
Epicgamerz0 is not online. Epicgamerz0
Joined: 25 Feb 2015
Total Posts: 45
27 Feb 2016 07:10 PM
function onPlayerEntered (plr)
local stats = Instance.new("IntValue")
stats.Name = "leaderstats"

local Money = Instance.new("IntValue")
Money.Name = "Money"
Money.Value = 0

Money.Parent = stats
stats.Parent = plr
end

game.Players.ChildAdded:connect(onPlayerEntered)



local colors = {"Shamrock","Quill grey","Buttermilk","Magenta","CGA brown","Cocoa","Gold", "Lime green", "Bronze", "Lily white", "Crimson", "Earth green", "Maroon", "Forest green", "Bright bluish green", "Bright blue", "New Yeller", "Br. yellowish green"}
while wait(60) do
for i,v in pairs(game.Players:GetPlayers() do
for x, color in pairs(colors) do
if v.TeamColor == BrickColor.new(color) then
v.leaderstats.Money.Value = v.leaderstats.Money.Value + 30
end
end
end
Report Abuse
kingkiller1000 is not online. kingkiller1000
Joined: 12 Dec 2008
Total Posts: 26415
27 Feb 2016 07:12 PM
Oops. I thought you said it needed a }, it needs a )

local colors = {"Shamrock","Quill grey","Buttermilk","Magenta","CGA brown","Cocoa","Gold", "Lime green", "Bronze", "Lily white", "Crimson", "Earth green", "Maroon", "Forest green", "Bright bluish green", "Bright blue", "New Yeller", "Br. yellowish green"}
while wait(60) do
for i,v in pairs(game.Players:GetPlayers()) do
for x, color in pairs(colors) do
if v.TeamColor == BrickColor.new(color) then
v.leaderstats.Money.Value = v.leaderstats.Money.Value + 30
end
end
end
end
Report Abuse
Epicgamerz0 is not online. Epicgamerz0
Joined: 25 Feb 2015
Total Posts: 45
28 Feb 2016 04:56 AM
It works! Thank you.
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