hit part event||doc136917

September 20, 2022

Format

 HIT_PART
  • The class of the function:Missile

describe

This event is fired when a projectile hits a part.


contextual content

The context content of the event

name type describe
part1 Part hit parts
obj2 Entity The entity that fires the projectile
missile Missile projectile example


code example

Find the corresponding projectile in the editor, right-click to copy its ID, plus the prefix is ​​its name, such as 'myplugin/testMissile'

on the server sideglobal script, register when this type of projectile hits a partCallback

local testMissileCfg = Missile.GetCfg("myplugin/testMissile") -- get projectile configuration information
Trigger.RegisterHandler(testMissileCfg, "HIT_BLOCK", function(context) 
local entity = context.obj2
local part = context.part1
print(entity.name,part.Name)
end)