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 » Scripters
Home Search
 

Re: Getting all the players in a script. HELP! Plz

Previous Thread :: Next Thread 
pokemonman018 is online. pokemonman018
Joined: 21 Aug 2012
Total Posts: 396
10 Sep 2016 02:00 PM
So I am trying to make a script where if you touch lava your torso has fire coming out of it. I don't know what to use to make it so it inserts no matter what your name is. Can anyone help?
Report Abuse
thedailyblarg is not online. thedailyblarg
Joined: 26 Feb 2012
Total Posts: 5506
10 Sep 2016 02:02 PM
http://wiki.roblox.com/index.php?title=Loops
for key,value in pairs(workspace:getChildren()) do
print(key,value.Name)
end
local dictionary = {
hi = 1;
yay = "wow";
cookies = "cool;
}
for key,value in pairs(dictionary) do
print(key,value.Name)
end

or

for key,value in ipairs(workspace:getChildren()) do
print(key,value.Name)
end
local dictionary = {
hi = 1;
yay = "wow";
cookies = "cool;
}
for key,value in ipairs(dictionary) do
print(key,value.Name)
end

or

for key,value in next,workspace:getChildren() do
print(key,value.Name)
end
local dictionary = {
hi = 1;
yay = "wow";
cookies = "cool;
}
for key,value in next,dictionary do
print(key,value.Name)
end
Report Abuse
thedailyblarg is not online. thedailyblarg
Joined: 26 Feb 2012
Total Posts: 5506
10 Sep 2016 02:02 PM
on the 2nd one, remove "value.Name" and change it to "value" because it will be a string already
Report Abuse
pokemonman018 is online. pokemonman018
Joined: 21 Aug 2012
Total Posts: 396
10 Sep 2016 02:06 PM
All it did was list the order things in the Workspace were in
Report Abuse
thedailyblarg is not online. thedailyblarg
Joined: 26 Feb 2012
Total Posts: 5506
10 Sep 2016 02:07 PM
well duh

look at the loops link in the wiki and obviously if it listed them then it went through them, like you wanted to, to go through the players
Report Abuse
pokemonman018 is online. pokemonman018
Joined: 21 Aug 2012
Total Posts: 396
10 Sep 2016 02:08 PM
Ok I obviously said it wrong.

I mean I want fire to be inserted into my players torso when I step on a brick.
Report Abuse
Mister_Manakin is not online. Mister_Manakin
Joined: 16 Sep 2009
Total Posts: 1935
10 Sep 2016 02:09 PM
The title of this thread and the post are two separate things.

For the issue in the title, use a for loop to get a list of players.

For the issue in the post, just return the player character associated with the .Touched event.
Report Abuse
thedailyblarg is not online. thedailyblarg
Joined: 26 Feb 2012
Total Posts: 5506
10 Sep 2016 02:09 PM
then you check if they have a humanoid and torso inside of them (and since it usually hits limbs, you have to check their parent)

and then put a fire in their torso if they do not have one
Report Abuse
pokemonman018 is online. pokemonman018
Joined: 21 Aug 2012
Total Posts: 396
10 Sep 2016 02:11 PM
script.Parent.Touched:connect(function(hit)
if hit and hit.Parent and hit.Parent:FindFirstChild("Humanoid") then
Instance.new("Fire",game.Workspace.Player)
hit.Parent.Humanoid.Health = hit.Parent.Humanoid.Health - 20
wait(1)
hit.Parent.Humanoid.Health = hit.Parent.Humanoid.Health - 20
wait(1)
hit.Parent.Humanoid.Health = hit.Parent.Humanoid.Health - 20
wait(1)
hit.Parent.Humanoid.Health = hit.Parent.Humanoid.Health - 20
wait(1)
hit.Parent.Humanoid.Health = hit.Parent.Humanoid.Health - 20
wait(1)
hit.Parent.Humanoid.Health = hit.Parent.Humanoid.Health - 20

end
end)


This is what I have....
Ignore the repeated lines...
Report Abuse
thedailyblarg is not online. thedailyblarg
Joined: 26 Feb 2012
Total Posts: 5506
10 Sep 2016 02:17 PM
again... use LOOPS

http://wiki.roblox.com/index.php?title=Loops

read the wiki pls because you arent

while humanoid.Health > 0 do
humanoid:TakeDamage(10)
wait(1)
end
Report Abuse
pokemonman018 is online. pokemonman018
Joined: 21 Aug 2012
Total Posts: 396
10 Sep 2016 02:19 PM
Sorry If im nooby. I just am not good, but I wont give up....
Report Abuse
Mister_Manakin is not online. Mister_Manakin
Joined: 16 Sep 2009
Total Posts: 1935
10 Sep 2016 02:19 PM
When I was a lil' noob I used redundant lines like that all the time. You won't believe how much time you can save by using for loops for stuff like damage.
Report Abuse
pokemonman018 is online. pokemonman018
Joined: 21 Aug 2012
Total Posts: 396
10 Sep 2016 02:20 PM
Ok I will!
Report Abuse
thedailyblarg is not online. thedailyblarg
Joined: 26 Feb 2012
Total Posts: 5506
10 Sep 2016 02:20 PM
you need to study them, you cant just copy and paste mine

so yes, loop up Loops in the wiki for roblox or lua-users if you want to understand it
Report Abuse
thedailyblarg is not online. thedailyblarg
Joined: 26 Feb 2012
Total Posts: 5506
10 Sep 2016 02:21 PM
look up loops*
Report Abuse
pokemonman018 is online. pokemonman018
Joined: 21 Aug 2012
Total Posts: 396
10 Sep 2016 02:28 PM
Ok I just cant do this it says Humanoid is a nil value .-.
Report Abuse
thedailyblarg is not online. thedailyblarg
Joined: 26 Feb 2012
Total Posts: 5506
10 Sep 2016 02:35 PM
because you copy and pasted my script

humanoid was the variable for their humanoid which if you check if it exist is hit.Parent:findFirstChild("Humanoid") .-.
Report Abuse
Mister_Manakin is not online. Mister_Manakin
Joined: 16 Sep 2009
Total Posts: 1935
10 Sep 2016 02:42 PM
I still cringe at the sight of one of my old time cycling scripts.

game.Lighting.TimeOfDay = "00:00:00"
wait()
game.Lighting.TimeOfDay = "00:00:01"
wait()
game.Lighting.TimeOfDay = "00:00:02"
wait()
game.Lighting.TimeOfDay = "00:00:03"
wait()
game.Lighting.TimeOfDay = "00:00:04"
wait()
game.Lighting.TimeOfDay = "00:00:05"
wait()
game.Lighting.TimeOfDay = "00:00:06"
wait()

You get the idea...
Report Abuse
pokemonman018 is online. pokemonman018
Joined: 21 Aug 2012
Total Posts: 396
10 Sep 2016 03:33 PM
Ok how would I use that loop to put fire into a characters torso
Report Abuse
pokemonman018 is online. pokemonman018
Joined: 21 Aug 2012
Total Posts: 396
10 Sep 2016 04:06 PM
I figured it out finally :D
Report Abuse
JellyJ3eans is not online. JellyJ3eans
Joined: 10 May 2011
Total Posts: 486
10 Sep 2016 04:37 PM
while hit and hit.Parent and hit.Parent:FindFirstChild("Humanoid") true do


+1
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • 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