-1

Im making a tower defense game in roblox and im wondering how to script towers having special effects when they hit a zombie, for example, freeze, slowness, poison etc. And how to make specific zombies immune to some of these effects.

Amogus
  • 1
  • 1
  • 1
    Heyo, StackOverflow is a place to get technical answers for specific questions, and the expectation is that you research and try to solve the problem first. So do you have any code to share from your attempts? – Kylaaa Jun 19 '22 at 18:35

2 Answers2

0

What you could do is put a script in the zombie that can interpret what tower hit it and decide if it should deal damage or effects or something like that.

Ian Weed
  • 64
  • 8
0

i would just have some numvalues inside the zombie and when u hit it change the value up 1 point and have another script in the value which will activate the effect and once the effect has been activated it removes 1 from the value.

u can change this around to fit the different effects so for a bleed effect you can name the value bleed and in the damage script when you hit a enemy it will findfirstchild for bleed and add 1 to the value and have another script within the value doing the bleed damage which would be something like

local bleedvalue = script.parent.value

local enemytype = script.parent.parent:waitforchild("humanoid") while wait(tick speed) do

if script.parent.value < 0 then

bleedvalue = bleedvalue - (ammount you want removed per tick)

enemytype.health = enemytype.health - (damage ammount and health can be changed out for speed or can straight up just anchor the zombie for a freeze)

end end

this was just off the top of my head so sorry if its wrong but i hope i helped anyone who may be seeking a alternative

ben
  • 1
  • As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Jul 27 '22 at 11:14