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: this is so dang annoying

Previous Thread :: Next Thread 
Alimegacorn is not online. Alimegacorn
Joined: 24 May 2013
Total Posts: 899
23 Jul 2016 02:53 PM
i've had this bug sit here for so long, and im just sitting here thinking, "it must be fixed, right?"
anyways the problem is this:
i have this script that deals damage when a NPC touches a raycasted part
(the NPC humanoid is called enemy btw)
the thing is that it works absolutely fine in studio, but fails when you go play the real game
the parent is a localscript which is in starterplayerscripts
the parent clones the script into the raycasted part and is your average day damage script

here it is:

function TakeDmg(hit)
if hit and hit.Parent and hit.Parent:FindFirstChild("Enemy") then
hit.Parent:FindFirstChild("Enemy").Health = hit.Parent:FindFirstChild("Enemy").Health - game.Lighting:FindFirstChild("VitalShotDamage").Value
game.Lighting:FindFirstChild("VitalShotDamage"):Destroy()
wait(0.5)
script.Disabled = true
script:Destroy()
end
end

script.Parent.Touched:connect(TakeDmg)

the output is clean
Report Abuse
Alimegacorn is not online. Alimegacorn
Joined: 24 May 2013
Total Posts: 899
23 Jul 2016 02:58 PM
vitalshotdamage btw is a numbervalue
Report Abuse
Alimegacorn is not online. Alimegacorn
Joined: 24 May 2013
Total Posts: 899
23 Jul 2016 03:31 PM
b
Report Abuse
Alimegacorn is not online. Alimegacorn
Joined: 24 May 2013
Total Posts: 899
23 Jul 2016 04:16 PM
b2
Report Abuse
Alimegacorn is not online. Alimegacorn
Joined: 24 May 2013
Total Posts: 899
23 Jul 2016 05:05 PM
b3
Report Abuse
Alimegacorn is not online. Alimegacorn
Joined: 24 May 2013
Total Posts: 899
24 Jul 2016 12:10 PM
b
Report Abuse
killerbot29003 is not online. killerbot29003
Joined: 04 Oct 2014
Total Posts: 3054
24 Jul 2016 12:43 PM
hit.Parent:FindFirstChild("enemy") since you said npc humanoid has the name "enemy" with no caps



This siggy is copyrighted ©
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