|
| 12 May 2015 06:19 PM |
DMG = script.Parent.Parent.Damage
function onTouch(part) local humanoid = part.Parent:FindFirstChild("Humanoid") if (humanoid ~= nil) then humanoid.Health = humanoid.Health -DMG.Value end --script.Parent:remove() end script.Parent.Touched:connect(onTouch)
It does no damage. The script.Parent.Parent.Damage is a NumberValue. |
|
|
| Report Abuse |
|
|
hdtv13
|
  |
| Joined: 18 Sep 2012 |
| Total Posts: 1628 |
|
|
| 12 May 2015 06:19 PM |
Use :Destroy() not :remove() Errors pls
I have skin, potatoes have skin, therefore I'm a potato. |
|
|
| Report Abuse |
|
|
|
| 12 May 2015 06:20 PM |
| I know. But that wasn't the question. I want to know why it does no damage. |
|
|
| Report Abuse |
|
|
hdtv13
|
  |
| Joined: 18 Sep 2012 |
| Total Posts: 1628 |
|
|
| 12 May 2015 06:22 PM |
.. I'm giving you advice. Whats the error?
I have skin, potatoes have skin, therefore I'm a potato. |
|
|
| Report Abuse |
|
|
hdtv13
|
  |
| Joined: 18 Sep 2012 |
| Total Posts: 1628 |
|
|
| 12 May 2015 06:24 PM |
I Just tested this, It works.
I have skin, potatoes have skin, therefore I'm a potato. |
|
|
| Report Abuse |
|
|
|
| 12 May 2015 06:25 PM |
| I asked why it does no damage, if you would have read the whole post. The damage value isn't zero. It's high damage. But, when the part is touched, it does no damage. |
|
|
| Report Abuse |
|
|
hdtv13
|
  |
| Joined: 18 Sep 2012 |
| Total Posts: 1628 |
|
|
| 12 May 2015 06:27 PM |
Whats DMG's value? I set it to 50 and it worked, Looped and killed me :(( You need to add something like this local run = true local DMG = script.Parent.Parent.DMG function onTouch(part) if run == true then run = false local humanoid = part.Parent:FindFirstChild("Humanoid") if (humanoid ~= nil) then humanoid.Health = humanoid.Health -DMG.Value wait(10) run = true end end end script.Parent.Touched:connect(onTouch)
I have skin, potatoes have skin, therefore I'm a potato. |
|
|
| Report Abuse |
|
|
|
| 12 May 2015 06:41 PM |
| Ugh. Still doesn't work. Is there any explanation behind this? |
|
|
| Report Abuse |
|
|
hdtv13
|
  |
| Joined: 18 Sep 2012 |
| Total Posts: 1628 |
|
|
| 12 May 2015 06:44 PM |
Whats the error?
I have skin, potatoes have skin, therefore I'm a potato. |
|
|
| Report Abuse |
|
|
voItages
|
  |
| Joined: 02 Nov 2013 |
| Total Posts: 677 |
|
|
| 12 May 2015 06:44 PM |
Why dont you do
dmg = 50 --whatever damage
function onTouch(hit) local humanoid = hit.Parent:FindFirstChild("Humanoid") if (humanoid ~= nil) then humanoid.Health:TakeDamage(dmg) end --script.Parent:remove() end script.Parent.Touched:connect(onTouch)
=volty= |
|
|
| Report Abuse |
|
|
|
| 12 May 2015 06:45 PM |
| Still doing no damage. So frusterating, because I seriously can't even see an error in the script... |
|
|
| Report Abuse |
|
|
hdtv13
|
  |
| Joined: 18 Sep 2012 |
| Total Posts: 1628 |
|
|
| 12 May 2015 06:45 PM |
^ What if the Value needs to be changed by other scripts?
I have skin, potatoes have skin, therefore I'm a potato. |
|
|
| Report Abuse |
|
|
voItages
|
  |
| Joined: 02 Nov 2013 |
| Total Posts: 677 |
|
| |
|
hdtv13
|
  |
| Joined: 18 Sep 2012 |
| Total Posts: 1628 |
|
|
| 12 May 2015 06:45 PM |
Ninja'ed
@Above check output..
I have skin, potatoes have skin, therefore I'm a potato. |
|
|
| Report Abuse |
|
|
|
| 12 May 2015 06:46 PM |
| And no, the damage has to be in a value. Not defined in the script. |
|
|
| Report Abuse |
|
|
hdtv13
|
  |
| Joined: 18 Sep 2012 |
| Total Posts: 1628 |
|
|
| 12 May 2015 06:46 PM |
gg Ninja'ed MK2
I have skin, potatoes have skin, therefore I'm a potato. |
|
|
| Report Abuse |
|
|
notfruit
|
  |
| Joined: 21 Sep 2012 |
| Total Posts: 1386 |
|
|
| 12 May 2015 07:33 PM |
Use the debugger in Roblox Studio to step through your code, and add breakpoints and stuff.
Then once you locate the problem, let us know. |
|
|
| Report Abuse |
|
|
97neko
|
  |
| Joined: 14 Sep 2014 |
| Total Posts: 16159 |
|
| |
|
025110
|
  |
| Joined: 23 Nov 2012 |
| Total Posts: 57661 |
|
|
| 12 May 2015 07:37 PM |
--[[Don't use takedamage it wont work with a forcefield]]
local dmg = 50; local db = false; script.Parent.Touched:connect(function(h) if not db then db = true; end if h:FindFirstChild("Humanoid") then h.Humanoid.Health = h.Humanoid.Health - dmg; end db = false; end) |
|
|
| Report Abuse |
|
|