|
| 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 |
|
|
|
| 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 |
|
|
|
| 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 |
|
|
|
| 10 Sep 2016 02:06 PM |
| All it did was list the order things in the Workspace were in |
|
|
| Report Abuse |
|
|
|
| 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 |
|
|
|
| 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 |
|
|
|
| 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 |
|
|
|
| 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 |
|
|
|
| 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 |
|
|
|
| 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 |
|
|
|
| 10 Sep 2016 02:19 PM |
| Sorry If im nooby. I just am not good, but I wont give up.... |
|
|
| Report Abuse |
|
|
|
| 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 |
|
|
| |
|
|
| 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 |
|
|
| |
|
|
| 10 Sep 2016 02:28 PM |
| Ok I just cant do this it says Humanoid is a nil value .-. |
|
|
| Report Abuse |
|
|
|
| 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 |
|
|
|
| 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 |
|
|
|
| 10 Sep 2016 03:33 PM |
| Ok how would I use that loop to put fire into a characters torso |
|
|
| Report Abuse |
|
|
|
| 10 Sep 2016 04:06 PM |
| I figured it out finally :D |
|
|
| Report Abuse |
|
|
|
| 10 Sep 2016 04:37 PM |
while hit and hit.Parent and hit.Parent:FindFirstChild("Humanoid") true do
+1 |
|
|
| Report Abuse |
|
|