generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

No error why wont this work?

Previous Thread :: Next Thread 
utabon is not online. 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
RitchTheEpic is not online. RitchTheEpic
Joined: 19 Apr 2011
Total Posts: 326
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
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image