|
| 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 |
|
|
|
| 23 Jul 2016 02:58 PM |
| vitalshotdamage btw is a numbervalue |
|
|
| Report Abuse |
|
|
| |
|
| |
|
| |
|
| |
|
|
| 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 |
|
|