TragedyTurtle Posted November 14, 2019 Share Posted November 14, 2019 How can you make a weapon execute a mob below a certain HP threshold? I've got this so far: local function onattack(inst, attacker, target) if target.health and target.components.health.currenthealth < 100 then target.components.health:Kill() end end Is it possible to add percentages to this as well? Like 25% health for example. Thanks! Link to comment Share on other sites More sharing options...
NikMik Posted November 16, 2019 Share Posted November 16, 2019 (edited) local function onattack(inst, attacker, target) if target.health ~= nil and target.components.health:GetPercent() < (target.components.health.maxhealth*0.25) then target.components.health:Kill() endend That oughta do it EDIT target.components.health.currenthealth < (target.components.health.maxhealth*0.25) would probably work better. Lmao Edited November 16, 2019 by Mr. Tiddles Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now