utabon
|
  |
| Joined: 12 Aug 2009 |
| Total Posts: 900 |
|
|
| 27 Jul 2013 10:54 AM |
I got no message. This script should show how many people are in a area. Thanks.
local Players = Game:GetService("Players")
function FindPlayersInRegion(region) local found_players = {} local region_cframe = region.CFrame local region_size = region.Size local region_size_x = region_size.X local region_size_y = region_size.Y local region_size_z = region_size.Z for _, player in ipairs(Players:GetPlayers()) do local character = player.Character if character then local humanoid for _, child in ipairs(character:GetChildren()) do if child:IsA("Humanoid") then humanoid = child break end end if humanoid then local torso = humanoid.Torso if torso then local offset = region_cframe:pointToObjectSpace(torso.Position) if math.abs(offset.X) <= 0.5 * region_size_x and math.abs(offset.Y) <= 0.5 * region_size_y and math.abs(offset.Z) <= 0.5 * region_size_z then table.insert(found_players, player) end end end end end return found_players end
-- Example print(unpack(FindPlayersInRegion(Region3.new(Vector3.new(0, 0, 0), Vector3.new(5, 5, 5))))) |
|
|
| Report Abuse |
|
|
| 27 Jul 2013 11:04 AM |
| Usually if there is no error coming up in the output, Then it means that the script is not running at all or it is working but not as intended. |
|
|
| Report Abuse |
|