Krimulous
|
  |
| Joined: 17 Mar 2011 |
| Total Posts: 7993 |
|
|
| 16 Aug 2016 03:00 AM |
I'd like to create a script that can keep track of who touched the finish line, but I don't know how to get the order that the players touch the finish line. I assume it'd be with some values but I don't know where to start with that. (1st place, 2nd place, 3rd place, etc) I've got this for reference: FinishLine.Touched:connect(function(hit) if hit.Parent:FindFirstChild("Humanoid") then end end)
If someone could add on to it or link me to a helpful resource that would be appreciated.
|
|
|
| Report Abuse |
|
|
|
| 16 Aug 2016 03:07 AM |
local player = game:GetService("Players").LocalPlayer local place local finished = false
for i = 1, maxplayers, -1 do FinishLine.Touched:connect(function(hit) local character = hit.Parent if character:FindFirstChild("Humanoid") then if finished == true then return end finished = true place = i print(player.Name.." has finished with a rank of: "..place"!") end end) end
Just something off the top of my head, hope it helps
Add 401 to display your RAP. |
|
|
| Report Abuse |
|
|
Krimulous
|
  |
| Joined: 17 Mar 2011 |
| Total Posts: 7993 |
|
|
| 16 Aug 2016 03:28 AM |
Thanks for the response Aang, but I was looking for a way to store the names so that I could retrieve them later in the round as part of a ceremony. How could I do that?
Also, I need it in a regular script, rather than a local script.
|
|
|
| Report Abuse |
|
|
Krimulous
|
  |
| Joined: 17 Mar 2011 |
| Total Posts: 7993 |
|
|
| 16 Aug 2016 02:37 PM |
bump
Also, I figured out how to store names and keep track of places.
Problem is, I don't know how to add a debounce so that a player can't simultaneously have their name stored in a value as multiple places. (Place1, Place2, Place3, etc.)
Can someone help with adding a debounce or something so that a player can only get one value towards them? (Place# and their name in the value)
FinishLine.Touched:connect(function(hit) if hit.Parent:FindFirstChild("Humanoid") then local str = Instance.new("StringValue") str.Name = "Place"..place str.Value = hit.Parent.Name str.Parent = FinishLine place = place + 1 end end)
|
|
|
| Report Abuse |
|
|