|
| 17 May 2015 05:58 AM |
if game.Workspace.Finished == true then wait(10) local scores = {} local players = {} for i,v in pairs(game.Players:GetPlayers()) do table.insert(scores, v:WaitForChild("IntValue")) end table.sort(scores, function(a, b) return a.Value > b.Value end) print(scores[1].Parent.Name .. " came in first! Score: " .. tostring(scores[1].Value)) print(scores[2].Parent.Name .. " came in second! Score: " .. tostring(scores[2].Value)) print(scores[3].Parent.Name .. " came in third! Score: " .. tostring(scores[3].Value)) print(scores[4].Parent.Name .. " came last. Score: " .. tostring(scores[3].Value))
end
It should print the username and what position they came in.
But it isnt printing anything, even when the boolean is activated. |
|
|
| Report Abuse |
|
|
|
| 17 May 2015 06:08 AM |
You're only checking if it is true once. Use the .Changed event.
game.Workspace.Finished.Changed:connect(function() if game.Workspace.Finished.Changed.Value = true then wait(10) local scores = {} local players = {} for i,v in pairs(game.Players:GetPlayers()) do table.insert(scores, v:WaitForChild("IntValue")) end table.sort(scores, function(a, b) return a.Value > b.Value end) print(scores[1].Parent.Name .. " came in first! Score: " .. tostring(scores[1].Value)) print(scores[2].Parent.Name .. " came in second! Score: " .. tostring(scores[2].Value)) print(scores[3].Parent.Name .. " came in third! Score: " .. tostring(scores[3].Value)) print(scores[4].Parent.Name .. " came last. Score: " .. tostring(scores[3].Value)) end
end) |
|
|
| Report Abuse |
|
|
|
| 17 May 2015 06:23 AM |
Nothing came out...
Im at a loss here, I dont get why it's not printing anything when it should be. |
|
|
| Report Abuse |
|
|
| |
|
|
| 17 May 2015 06:38 AM |
Wrote it wrong. >_>
game.Workspace.Finished.Changed:connect(function() if game.Workspace.Finished.Value = true then wait(10) local scores = {} local players = {} for i,v in pairs(game.Players:GetPlayers()) do table.insert(scores, v:WaitForChild("IntValue")) end table.sort(scores, function(a, b) return a.Value > b.Value end) print(scores[1].Parent.Name .. " came in first! Score: " .. tostring(scores[1].Value)) print(scores[2].Parent.Name .. " came in second! Score: " .. tostring(scores[2].Value)) print(scores[3].Parent.Name .. " came in third! Score: " .. tostring(scores[3].Value)) print(scores[4].Parent.Name .. " came last. Score: " .. tostring(scores[3].Value)) end
end) |
|
|
| Report Abuse |
|
|
|
| 17 May 2015 07:01 AM |
I think it may be an underlying problem.
This, for example, isnt working:
game.Workspace.Finished.Changed:connect(function() if game.Workspace.Finished == true then wait(6) workspace.applause:Play() end end)
And considering your really good with scripting, i think it may be a problem with the variable itself, or something else... |
|
|
| Report Abuse |
|
|
|
| 17 May 2015 07:05 AM |
Put a bunch of prints after everything and check where it stops.
Also, can I have the paths like:
-Workspace --Finished (Boolean)
|
|
|
| Report Abuse |
|
|
spinywind
|
  |
| Joined: 26 Jan 2012 |
| Total Posts: 3580 |
|
|
| 17 May 2015 07:10 AM |
| do you want it to print as a message or on a score board or gui o something like that because when you say print(hfsdgsdgsdhfs) that only prints to output |
|
|
| Report Abuse |
|
|
|
| 17 May 2015 07:14 AM |
It stops here:
table.insert(scores, v:WaitForChild("IntValue"))
|
|
|
| Report Abuse |
|
|
|
| 17 May 2015 07:19 AM |
| I only want it to print to output. |
|
|
| Report Abuse |
|
|
|
| 17 May 2015 07:23 AM |
v:WaitForChild("IntValue")
if it stop here it probably i waiting for an instance named IntValue inside of v right. :3 check if that value exists. |
|
|
| Report Abuse |
|
|
AlgyLacey
|
  |
| Joined: 14 Jun 2013 |
| Total Posts: 3736 |
|
|
| 17 May 2015 07:26 AM |
Found la problemo.
"game.Workspace.Finished.Value == true"
Finished is an object, and therefore will never equal true. :)
{-[ Check this out! http://www.roblox.com/games/217210581/Farmulator ]-} |
|
|
| Report Abuse |
|
|
| |
|
|
| 17 May 2015 07:46 AM |
The IntValue stores how many points a user got
It is inside every single user
and it is located in game.Players.(user).value |
|
|
| Report Abuse |
|
|
|
| 17 May 2015 07:48 AM |
Oh. Wait. I understood algy wrong. He's right. Replace the first line with:
while game.Workspace.Finished.Value == true do |
|
|
| Report Abuse |
|
|
|
| 17 May 2015 07:50 AM |
AHA! I FOUND THE ROOT PROBLEM
i managed to get the intvalue defined.
It was about to print the username and the position they came in.
But instead it spat out this:
Workspace.Scoring:15: attempt to index field '?' (a number value) |
|
|
| Report Abuse |
|
|
| |
|
| |
|
|
| 17 May 2015 08:42 AM |
| I'm not going to count lines. what line is line 15? |
|
|
| Report Abuse |
|
|
|
| 17 May 2015 08:47 AM |
Isn't it obvious?
Line 15 is where it starts to print the username and values:
print(scores[1].Parent.Name .. " came in first! Score: " .. tostring(scores[1].Value)) print(scores[2].Parent.Name .. " came in second! Score: " .. tostring(scores[2].Value)) print(scores[3].Parent.Name .. " came in third! Score: " .. tostring(scores[3].Value)) print(scores[4].Parent.Name .. " came last. Score: " .. tostring(scores[3].Value)) |
|
|
| Report Abuse |
|
|
GOLDC3PO
|
  |
| Joined: 31 May 2011 |
| Total Posts: 509 |
|
|
| 17 May 2015 08:50 AM |
game.Workspace.Changed:connect(function() if game.Workspace.Finished.Changed.Value = true then wait(10) local scores = {} local players = {} for i,v in pairs(game.Players:GetPlayers()) do table.insert(scores, v:WaitForChild("IntValue")) end table.sort(scores, function(a, b) return a.Value > b.Value end) print(scores[1].Parent.Name .. " came in first! Score: " .. tostring(scores[1].Value)) print(scores[2].Parent.Name .. " came in second! Score: " .. tostring(scores[2].Value)) print(scores[3].Parent.Name .. " came in third! Score: " .. tostring(scores[3].Value)) print(scores[4].Parent.Name .. " came last. Score: " .. tostring(scores[3].Value)) end
end)
|
|
|
| Report Abuse |
|
|
|
| 17 May 2015 08:52 AM |
add this before that line and give me the output
print(scores[1], type(scores[1])) print(scores[1].ClassName, scores[1].Parent) |
|
|
| Report Abuse |
|
|
|
| 17 May 2015 09:00 AM |
3 number
Workspace.Scoring:16: attempt to index field '?' (a number value) |
|
|
| Report Abuse |
|
|
|
| 17 May 2015 09:05 AM |
| It did print the number of points i got, so that's a good sign. |
|
|
| Report Abuse |
|
|
| |
|