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: NPC doesn't get hurt but plr does

Previous Thread :: Next Thread 
cxcharlie is not online. cxcharlie
Joined: 26 Aug 2009
Total Posts: 1414
12 Oct 2013 03:31 PM
ex is an explosion and it's supposed to hurt plrs and NPCs, but it only hurts plrs. Why is this happening?
Please find: "Damage to NPC RIGHT HERE"
Thanks to everyone that helps :D
(everything is defined this is only part of my script)

ex.Hit:connect(function(hitPart, partDistance)
print('jiy')--goes pass
if hitPart.Parent:FindFirstChild('Humanoid')~=nil then
print('hum dere')
local humanoid=hitPart.Parent:FindFirstChild('Humanoid')
if game.Players:GetPlayerFromCharacter(hitPart.Parent).ClassName=='Player' then
print('is plr')
local plr=game.Players:GetPlayerFromCharacter(hitPart.Parent)
if plr.TeamColor~=player.TeamColor then--Damage non-team Player

local maxDamage = 300 -- maximum possible damage
local distance_factor = partDistance/ex.BlastRadius

distance_factor = 1.3 - distance_factor
humanoid:TakeDamage(maxDamage*distance_factor)
elseif plr.TeamColor==player.TeamColor and FriendlyFire==true then-
local maxDamage = 300

local distance_factor = partDistance/ex.BlastRadius

distance_factor = 1.3 - distance_factor
humanoid:TakeDamage(maxDamage*distance_factor)
elseif plr.TeamColor==player.TeamColor and FriendlyFire==false then
end--what team?
else -- Damage to NPC RIGHT HERE
print('hur noc')
local maxDamage = 300 -- maximum possible damage

local distance_factor = partDistance/ex.BlastRadius

distance_factor = 1.3 - distance_factor
humanoid:TakeDamage(maxDamage*distance_factor)

end--is it a real plr
end--is there a humanoid in it?
end)--explosion hit function
Report Abuse
jnickib is not online. jnickib
Joined: 28 May 2012
Total Posts: 137
12 Oct 2013 03:32 PM
You need to make your question more clear.


~It's me, 08C, on an alt for 1 day!
Report Abuse
cxcharlie is not online. cxcharlie
Joined: 26 Aug 2009
Total Posts: 1414
12 Oct 2013 03:39 PM
Ex is an explosion that's supposed to hurt players and NPCs. (non-Player Characters)
It only hurts players.
why?
happy?
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