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: Analysis of why won't this work, please?

Previous Thread :: Next Thread 
theninjaguy987 is not online. theninjaguy987
Joined: 21 Jun 2013
Total Posts: 766
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 is not online. 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
theninjaguy987 is not online. theninjaguy987
Joined: 21 Jun 2013
Total Posts: 766
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 is not online. 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 is not online. 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
theninjaguy987 is not online. theninjaguy987
Joined: 21 Jun 2013
Total Posts: 766
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 is not online. 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
theninjaguy987 is not online. theninjaguy987
Joined: 21 Jun 2013
Total Posts: 766
12 May 2015 06:41 PM
Ugh. Still doesn't work. Is there any explanation behind this?
Report Abuse
hdtv13 is not online. 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 is not online. 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
theninjaguy987 is not online. theninjaguy987
Joined: 21 Jun 2013
Total Posts: 766
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 is not online. 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 is not online. voItages
Joined: 02 Nov 2013
Total Posts: 677
12 May 2015 06:45 PM
try removing local



=volty=
Report Abuse
hdtv13 is not online. 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
theninjaguy987 is not online. theninjaguy987
Joined: 21 Jun 2013
Total Posts: 766
12 May 2015 06:46 PM
And no, the damage has to be in a value. Not defined in the script.
Report Abuse
hdtv13 is not online. 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 is not online. 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 is not online. 97neko
Joined: 14 Sep 2014
Total Posts: 16159
12 May 2015 07:34 PM
_G global variables

無料の魂
Report Abuse
025110 is not online. 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
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