jamer55
|
  |
| Joined: 03 Mar 2010 |
| Total Posts: 32 |
|
|
| 20 Feb 2015 05:47 AM |
local i = 0 for _,v in pairs(workspace:GetChildren()) do if v.Name == "yay" then i = i + 1 end end game.Players.PlayerAdded:connect(function(player) local leaderstats = Instance.new("Model", player) leaderstats.Name = "leaderstats" end) while true do wait (1) local b = Instance.new("IntValue", leaderstats) b.Name = "Total bricks" b.Value = i end
Output: i dont know becuse it crashes |
|
|
| Report Abuse |
|
|
|
| 20 Feb 2015 08:09 AM |
remove a part of the script see where its crashing have tones of waits |
|
|
| Report Abuse |
|
|
|
| 20 Feb 2015 08:15 AM |
local i = 0 for _,v in pairs(workspace:GetChildren()) do if v.Name == "yay" then i = i + 1 end end game.Players.PlayerAdded:connect(function(player) local leaderstats = Instance.new("Model", player) leaderstats.Name = "leaderstats" end) while true do local b = Instance.new("IntValue", leaderstats) b.Name = "Total bricks" b.Value = i wait(1) end |
|
|
| Report Abuse |
|
|
|
| 20 Feb 2015 08:38 AM |
| You put a space after wait. So, that's the reason Roblox is crashing. |
|
|
| Report Abuse |
|
|
eLunate
|
  |
| Joined: 29 Jul 2014 |
| Total Posts: 13268 |
|
|
| 20 Feb 2015 08:41 AM |
| Not certainly; Lua's grammar is fairly good at interpreting whitespace |
|
|
| Report Abuse |
|
|
|
| 20 Feb 2015 08:44 AM |
| Well, eLunate, his script looks fine, except for the wait (1) part. Henceforth, that should be the reason of his Roblox crashing. |
|
|
| Report Abuse |
|
|
eLunate
|
  |
| Joined: 29 Jul 2014 |
| Total Posts: 13268 |
|
|
| 20 Feb 2015 08:52 AM |
Doesn't matter. If it wasn't waiting then it would error anyway.
I blame something else. |
|
|
| Report Abuse |
|
|
|
| 20 Feb 2015 09:43 AM |
... -.- .-. Did you even read the bottom... It isn't waiting because of that problem, and causes the crash. |
|
|
| Report Abuse |
|
|
|
| 20 Feb 2015 09:46 AM |
The real question would be is the crash from a hang?
Give me 15 Robux I give you print("Give me 15k") |
|
|
| Report Abuse |
|
|
eLunate
|
  |
| Joined: 29 Jul 2014 |
| Total Posts: 13268 |
|
|
| 20 Feb 2015 09:52 AM |
| I did read the bottom, and it would error if it wasn't waiting because other wise Lua would be interpreting two plain value states - The function, and the number. Together they are an invalid syntax because Lua receives an incomplete statement. |
|
|
| Report Abuse |
|
|
jamer55
|
  |
| Joined: 03 Mar 2010 |
| Total Posts: 32 |
|
|
| 20 Feb 2015 10:17 AM |
| i tried doing that script but it randomly crashed. |
|
|
| Report Abuse |
|
|
eLunate
|
  |
| Joined: 29 Jul 2014 |
| Total Posts: 13268 |
|
|
| 20 Feb 2015 10:20 AM |
Told you.
Stop using free models ^^ |
|
|
| Report Abuse |
|
|
|
| 20 Feb 2015 10:33 AM |
First off, since you're making leaderstats local; it can only be read within the scope First off, you should be getting an error because you made leaderstat local. Since you made it only readable in the scope of the PlayerAdded function. You should probably seeing some sort of error on 'local b = Instance.new("IntValue", leaderstats)' It probably says something such as "Undeclared/Unknown Variable leaderstats"
Try this:
steve = coroutine.create(function() local b = Instance.new("IntValue",leaderstats) b.Name = "Total Bricks" b.Value = countyay() end)
function countyay(loc) local counter = 0 loc = loc or workspace for _,v in pairs(loc) do if v.Name:lower() == "yay" then counter = counter + 1 end end return counter end
game.Players.PlayerAdded:connect(function(p) leaderstats = Instance.new("Folder",p) p.Name = "leaderstats" coroutine.resume(steve) end)
However, you can save some time and just have the playerAdded event as this
game.Players.PlayerAdded:connect(function(p) leaderstats = Instance.new("Folder",p) p.Name = "leaderstats" b = Instance.new("Intvalue",leaderstats) b.Value = countyay() end)
|
|
|
| Report Abuse |
|
|
|
| 20 Feb 2015 10:37 AM |
im sorry but
"Output: i dont know becuse it crashes"
that is the best line I've ever heard in a while lol |
|
|
| Report Abuse |
|
|