i come back 2050 :
:local lastX, lastY = nil, nil
local timer = 0
function OnSpawned(requestId, entities)
if entities then
for i = 1, #entities do
entities[i]:setColor(0.2, 0.8, 1, 0.4)
end
end
end
function OnTick()
local targetId = inputs.entity.target
if not targetId or targetId == 0 then
return
end
local e = Entity(targetId)
if e:isValid() ~= 1 then
return
end
local x, y = e:getPosition()
-- Initialize previous position
if not lastX then
lastX, lastY = x, y
return
end
-- Calculate movement
local dx = x - lastX
local dy = y - lastY
local distSq = dx * dx + dy * dy
if distSq > 0.0005 then
timer = timer + env.deltaTime()
if timer >= 0.05 then
timer = 0
spawn.cloneTemp(targetId, x, y)
end
else
-- Reset timer when not moving
timer = 0
end
-- Save current position
lastX, lastY = x, y
end
2026-07-12 22:33:43