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
 

Re: Finding and Manipulating all Players in a Place?

Previous Thread :: Next Thread 
SockPuppetCow is not online. SockPuppetCow
Joined: 14 Sep 2012
Total Posts: 121
26 Feb 2013 10:44 PM
----------
--Components--

--Values
local Range = script.Parent.Range.Value
local Damage = script.Parent.Damage.Value
local Time = script.Parent.Time.Value

--Parts
local Node = script.Parent.MainPart

--Tables
local players = {}

--Components--
----------

---------
--Functions--

--Adding Joining Players to Table 'players'
game.Players.PlayerAdded:connect(function(player)
table.insert(players,v)
end)

--Finding players in range
while true do
wait()
for i,c in pairs (players) do
local char = c.Character
if (char.Torso.Position - Node.Position).magnitude <= Radius then
while char.Humanoid.Health > 0 and (char.Torso.Position - Cone.Position).magnitude <= Range do
char.Humanoid.Health = char.Humanoid.Health - Damage
print(c.Name .. " Damaged by " .. Damage)
wait(Time)
end
end
end
end

--Functions--
---------
Report Abuse
th3oracle is not online. th3oracle
Joined: 23 Feb 2013
Total Posts: 448
26 Feb 2013 10:46 PM
Is there an output?
Report Abuse
Christbru01 is not online. Christbru01
Joined: 03 Apr 2010
Total Posts: 649
26 Feb 2013 10:47 PM
What are you asking? Where is the output? Why did you not read and abide by the rules here?...
Report Abuse
Xnite515 is not online. Xnite515
Joined: 18 Feb 2011
Total Posts: 22763
26 Feb 2013 10:48 PM
table.insert(players, player.Name)


for i,c in pairs (players) do
local char = c.Character
players is a table so you're going to have to hardcode it.
for i,c in pairs (players) do
local char = game.Players[c.Name].Character

I believe that should work..
Report Abuse
SockPuppetCow is not online. SockPuppetCow
Joined: 14 Sep 2012
Total Posts: 121
26 Feb 2013 10:52 PM
Thanks Xnite, I'll try it and get back to you. And christbru, there was no output, if there was I would've said so. And of course I abide by the rules. There's no need to be like that. I included what I thought was necessary for people to properly fix the problem, if you don't have anything helpful, why even visit this forum?
Report Abuse
Christbru01 is not online. Christbru01
Joined: 03 Apr 2010
Total Posts: 649
26 Feb 2013 10:56 PM
I am here because I can help most anyone with scripting... Though I need something to help, and there is nothing that you posted besides a script and a title which doesn't explain much either... just a simple 'I am trying to get this to do suchandsuch and it is not working, help?' would have been useful :P Also, if no output then why not state as much? >.>
Report Abuse
Christbru01 is not online. Christbru01
Joined: 03 Apr 2010
Total Posts: 649
26 Feb 2013 10:58 PM
http://www.roblox.com/Forum/ShowPost.aspx?PostID=80625843

Simply reading that, which is stickyed on top of the Scripting Helpers forum which this is in, will show you exactly what I am talking about...
Report Abuse
SockPuppetCow is not online. SockPuppetCow
Joined: 14 Sep 2012
Total Posts: 121
26 Feb 2013 11:07 PM
Right. I'm sorry I kinda over reacted. :/
And I thought I had written something else above and below the script but I guess not. I was just kinda in a hurry to get this thing done. That's been happening lately. Again I'm sorry for talki...typing... to you that way, I'll make sure of things next time.

And Xnite, the only problem with the fix you gave me was game.Players[c.Name].Character didn't work because it expected a string in the brackets. I fixed it by replacing it with game.Players:findFirstChild(c).Character and now it works perfectly, other than the over time thing which was only for testing and doesn't need to be there.

Thanks to both of you for helping me with completely different things, one of you with the script, the other with my brain...

Note: There was no sarcasm here, it can seem like there is sometimes...
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