|
| 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 |
|
|
| |
|
RPG_Dev
|
  |
| Joined: 19 Nov 2011 |
| Total Posts: 419 |
|
| |
|
|
| 27 Feb 2016 06:45 PM |
| None. I just spawn and its not there. |
|
|
| Report Abuse |
|
|
|
| 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 |
|
|
|
| 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 |
|
|
| |
|
|
| 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 |
|
|
|
| 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 |
|
|
|
| 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 |
|
|
| |
|