Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

why would this get slower?

This goes fast at the first but as this function runs it slows down and after I run the function about 2-3 times it gets so slowww... (Its like 2 minutes) Any IdeaS? If you need a little video to explaine "Slow" down https://www.youtube.com/watch?v=xhp6dYovZHE

function Dismiss(plr)
    for _, v in pairs(Tablets) do
        if v.Plr == plr.Name then
            for i = 0, 1, 0.1 do
                wait(0.01)
                v.Tab.Transparency = i
                v.Box.Transparency = i
                if i==1 then 
                break
                end
            end
            v.Tab:Remove()
            break
        end
    end
end

1 answer

✓ Accepted answer

You should use good style. Spaces and tabs make it much more readable.

Your use of the if is probably not what you wanted. You probably wanted this:

function Dismiss(plr)
	for _, v in pairs(Tablets) do
		if v.Plr == plr.Name then
			for i = 0, 1, 0.1 do
				wait(0.01)
				v.Tab.Transparency = i
				v.Box.Transparency = i
			end
			v.Tab:Remove()
			break
		end
	end
end

Why it would be slow? I am not sure.

Most likely there is another problem. This doesn't change anything that would require more work to do anything. One concern is that it eliminates a portion of v but does not remove v from the list of Tablets.

This discussion is preserved as it was. New answers, comments, and votes are closed.