Roblox tds game

519 Views Asked by At

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.

2

There are 2 best solutions below

0
Ian Weed On

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.

1
ben On

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