Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
-1

Help with my lag reduce?

Asked by 8 years ago

I have this lag reduce script I'm working on. No errors appear in output, but it doesn't work. Help please?

local items = workspace:GetChildren()

function reduce()
local num = 0
for i = 1, #items do
if items[i].ClassName == "Hat" then
    num = num + 1
    items[i]:remove()
    end
end
local hint = Instance.new("Hint",workspace)
hint.Text = "Entity Remover has removed "..num.." items!"
wait(1)
hint:remove()
end

while wait(30) do
reduce()
end
0
Wat's It supposed to do? LateralLace 297 — 8y
0
NOTE that you might wanna update the "Items" table every time you run the function. LateralLace 297 — 8y

1 answer

Log in to vote
0
Answered by 8 years ago

You have to place line 1 inside the function, your getting the number of items in the workspace, it hasn't updated so its assuming theres nothing in it.

Ad

Answer this question