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: explosion.hit event is not triggered

Previous Thread :: Next Thread 
MrChickens is not online. MrChickens
Joined: 21 Feb 2009
Total Posts: 1076
20 Aug 2012 09:09 AM
ExpRadius = 8
MinDamage = 0
MaxDamage = 120

Detonated = false
Multiplier = (MaxDamage-MinDamage)/ExpRadius

ball = script.Parent

function onTouched(hit)
if Detonated == true then return end
if hit.Name == "Border" then return end
if hit.Transparency >= 0.975 then return end
Detonated = true
local e = Instance.new("Explosion")
e.Parent = game.Workspace
e.Position = ball.Position
e.ExplosionType = 2
e.BlastPressure = 5
e.BlastRadius = ExpRadius
e.Hit:connect(function(Hit, Distance)
local humanoid = Hit.Parent:FindFirstChild("Humanoid")
local Bag = ball:findFirstChild("creator")
if humanoid then
tagHumanoid(humanoid)
local Flip = ExpRadius-Distance
local Receive = (Flip*Multiplier)+MinDamage
humanoid:TakeDamage(Receive)
print(Bag.Value.Name.." Detonated "..humanoid.Name..", causing "..Receive.." Damage. The explosion happened "..Distance.." studs away from the victim yeilding "..Flip.." Power.")
end
end)
e:Destroy()
end

function tagHumanoid(humanoid)
local Bag = ball:findFirstChild("creator")
if Bag ~= nil then
local NTag = Bag:clone()
NTag.Parent = humanoid
game:GetService("Debris"):AddItem(NTag, 2)
end
end

game:GetService("Debris"):AddItem(ball, 10)
ball.Touched:connect(onTouched)





e.Hit:connect(function(Hit, Distance) is never triggered
Report Abuse
MrChickens is not online. MrChickens
Joined: 21 Feb 2009
Total Posts: 1076
20 Aug 2012 09:27 AM
BUMP

Report Abuse
Destroshun is not online. Destroshun
Joined: 12 Aug 2012
Total Posts: 764
20 Aug 2012 09:33 AM
...

† KMXD 2.0 †
Report Abuse
MrChickens is not online. MrChickens
Joined: 21 Feb 2009
Total Posts: 1076
20 Aug 2012 09:40 AM
@Destroshun
Please troll + noob, Get out.
Report Abuse
Destroshun is not online. Destroshun
Joined: 12 Aug 2012
Total Posts: 764
20 Aug 2012 09:41 AM
I'm not the idiot that can't trigger an explosion.

† KMXD 2.0 †
Report Abuse
MrChickens is not online. MrChickens
Joined: 21 Feb 2009
Total Posts: 1076
20 Aug 2012 09:43 AM
Hah, you don't even understand what Explosion.Hit is.
I can create the explosion, but I can't utilize the event which is called when a part is in the Radius of an explosion.
Report Abuse
StealthKing95 is not online. StealthKing95
Joined: 13 Dec 2008
Total Posts: 4263
20 Aug 2012 09:46 AM
I am not sure how .Hit works, since I've never used it before,
But you should also try if it works with magnitude. Not that hard to do.
Report Abuse
crazyman32 is online. crazyman32
Joined: 13 Apr 2008
Total Posts: 18027
20 Aug 2012 09:46 AM
You need to create the event BEFORE you set the parent of the explosion.
Report Abuse
Destroshun is not online. Destroshun
Joined: 12 Aug 2012
Total Posts: 764
20 Aug 2012 09:47 AM
Noob got owned by crazyman32 :P

† KMXD 2.0 †
Report Abuse
MrChickens is not online. MrChickens
Joined: 21 Feb 2009
Total Posts: 1076
20 Aug 2012 09:48 AM
Thanks :D
Report Abuse
MrChickens is not online. MrChickens
Joined: 21 Feb 2009
Total Posts: 1076
20 Aug 2012 09:49 AM
@TheNoob2Above

How is being helped called "Owned"

Get out, Troll.
Report Abuse
crazyman32 is online. crazyman32
Joined: 13 Apr 2008
Total Posts: 18027
20 Aug 2012 09:49 AM
Also the Hit event is a little buggy, so be precautionary with it.

Sometimes I've had instances where it says EVERY object was hit by the explosion, even when they were not.
Report Abuse
Destroshun is not online. Destroshun
Joined: 12 Aug 2012
Total Posts: 764
20 Aug 2012 09:50 AM
Shut up idiot.

† KMXD 2.0 †
Report Abuse
Destroshun is not online. Destroshun
Joined: 12 Aug 2012
Total Posts: 764
20 Aug 2012 09:50 AM
Not you crazy.

† KMXD 2.0 †
Report Abuse
MrChickens is not online. MrChickens
Joined: 21 Feb 2009
Total Posts: 1076
20 Aug 2012 09:52 AM
Thanks for the heads up. If I find that it is causing that glitch too, I'll add a restriction to check its magnitude.
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