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: How would you do this?

Previous Thread :: Next Thread 
ScriptDrone is not online. ScriptDrone
Joined: 24 Jun 2010
Total Posts: 64
13 Sep 2011 05:12 PM
I'm looking to make a script that damages the player slightly every second, but if the player steps off of it, it stops damaging him. Here is my kill script, it just needs some editing:


dmg = 1000
script.Parent.Touched:connect(function(hit)
if hit.Parent.Humanoid then do
hit.Parent.Humanoid:TakeDamage(dmg)
end
end
end)
Report Abuse
jessemccullough9292 is not online. jessemccullough9292
Joined: 10 Jul 2008
Total Posts: 590
13 Sep 2011 05:13 PM
You know it wont slightly take their health, it will kill the Player.
Report Abuse
ScriptDrone is not online. ScriptDrone
Joined: 24 Jun 2010
Total Posts: 64
13 Sep 2011 05:14 PM
'it just needs some editing'

Learn to read.
Report Abuse
ScriptDrone is not online. ScriptDrone
Joined: 24 Jun 2010
Total Posts: 64
13 Sep 2011 05:20 PM
Dios mío! Can no one answer this?
Report Abuse
ElectricBlaze is not online. ElectricBlaze
Joined: 18 Jul 2011
Total Posts: 22930
13 Sep 2011 05:28 PM
dmg = 1000
script.Parent.Touched:connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") then
hit.Parent.Humanoid:TakeDamage(dmg)
end
end
end)


-Like an __AWESOME__ boss
Report Abuse
ScriptDrone is not online. ScriptDrone
Joined: 24 Jun 2010
Total Posts: 64
13 Sep 2011 05:31 PM
Why did you just copy my script?

Plus that wouldn't even work.

Can you FREAKING learn to READ?
READ. THE. ENTIRE. THREAD.
Report Abuse
ElectricBlaze is not online. ElectricBlaze
Joined: 18 Jul 2011
Total Posts: 22930
13 Sep 2011 05:32 PM
Script, YOU learn to read. Your's wouldn't work for two reasons:

1. if statements do _NOT_ use a 'do'
2. If hit's parent didn't have a Humanoid, it would error.

-Like an __AWESOME__ boss
Report Abuse
Dyvoliox is not online. Dyvoliox
Joined: 08 Sep 2011
Total Posts: 28
13 Sep 2011 05:33 PM
@ScriptDrone

I read the entire thread :D

I would use the .StoppedTouching event, but, of course, it's locked, so you should either use a while loop with magnitude or a while loop with Region3.
Report Abuse
ScriptDrone is not online. ScriptDrone
Joined: 24 Jun 2010
Total Posts: 64
13 Sep 2011 05:33 PM
I COULD CARE LESS!
YOU'RE NOT HELPING ME!
I'M TRYING TO MAKE IT SO IT SLOWLY DAMAGES YOU, BUT IF YOU STEP OFF OF IT, IT STOPS!
Report Abuse
ScriptDrone is not online. ScriptDrone
Joined: 24 Jun 2010
Total Posts: 64
13 Sep 2011 05:34 PM
@Dy

I'm not really sure how to do that, though D:
Report Abuse
WishNite is not online. WishNite
Joined: 11 Feb 2009
Total Posts: 15828
13 Sep 2011 05:35 PM
Or you can use magnitude...
Report Abuse
Dyvoliox is not online. Dyvoliox
Joined: 08 Sep 2011
Total Posts: 28
13 Sep 2011 05:38 PM
Hmm. I don't really know magnitude or Region3, I just know it's something like this:

--Put this in the brick
while true do
local chil = game.Workspace:getChildren()
for i, v in pairs(chil) do
if v:findFirstChild("Humanoid") then
if v:findFirstChild("Torso") then
if v.Torso.Position - script.Parent.Position.magnitude >= 1 then
local s = script.Parent.damagingScript:Clone() --[[Make sure the damaging script is in the brick]]
s.Parent = v
wait()
else
print("Not close enough. Do nothing.")
end
end
end
end
end
Report Abuse
Dyvoliox is not online. Dyvoliox
Joined: 08 Sep 2011
Total Posts: 28
13 Sep 2011 05:39 PM
If my script doesn't work (chances are it will, I just guessed at the magnitude part), give it to ElectricBlaze and he might fix it.
Report Abuse
ElectricBlaze is not online. ElectricBlaze
Joined: 18 Jul 2011
Total Posts: 22930
13 Sep 2011 05:40 PM
Yes, that wouldn't work. But I'm not sure if I want to fix it, now.


-Like an __AWESOME__ boss
Report Abuse
ElectricBlaze is not online. ElectricBlaze
Joined: 18 Jul 2011
Total Posts: 22930
13 Sep 2011 05:42 PM
Okay, fine, whatever. But ScriptDrone, try not to yell at us when we're only teying to help. Thanks. xP

Try this:

while true do
local chil = game.Workspace:GetChildren()
for i, v in pairs(chil) do
if v:findFirstChild("Humanoid") then
if v:findFirstChild("Torso") then
if (v.Torso.Position - script.Parent.Position).magnitude >= 1 then
local s = script.Parent.damagingScript:Clone() --Make sure the damaging script is in the brick
s.Parent = v
wait()
else
print("Not close enough. Do nothing.")
end
end
end
end
end


-Like an __AWESOME__ boss
Report Abuse
Dyvoliox is not online. Dyvoliox
Joined: 08 Sep 2011
Total Posts: 28
13 Sep 2011 05:43 PM
@ElectricBlaze

So all I did was forget parenthesis? D:

i no be happy
Report Abuse
ElectricBlaze is not online. ElectricBlaze
Joined: 18 Jul 2011
Total Posts: 22930
13 Sep 2011 05:44 PM
lololol


-Like an __AWESOME__ boss
Report Abuse
Dyvoliox is not online. Dyvoliox
Joined: 08 Sep 2011
Total Posts: 28
13 Sep 2011 05:48 PM
@ElectricBlaze

dood whai u laugh bro not cul
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