healing glitch

  • Bunborg
    9th Mar 2021 Member 0 Permalink

    I tried to make a new element heal stkm but for some reason it only works when it is in the update function but thta causes loads of lag. I created the solution of writing "

    lasttime = 0 

    if os.time() > lasttime then 

    lasttime = os.time()  

    for i in sim.neighbors(x,y,8,8) do
    if sim.partProperty(i, sim.FIELD_TYPE) == elements.DEFAULT_PT_STKM or sim.partProperty(i, sim.FIELD_TYPE) == elements.DEFAULT_PT_STK2 then
    sim.partProperty(r, sim.FIELD_LIFE, 100)
    end
    end"

     

    but when i added the lag reducing bit (the bit with os.time() and lasttime) it stopped working, and i don't know why or how to fix it

    how do i fix it or what is an alternative method of achieving a stickman healing device

  • LBPHacker
    9th Mar 2021 Developer 0 Permalink
    Please post the entire script, preferably on pastebin.