Im trying to make a maid, is it good?

I feel like the script is a little too basic. I want to make a Maid for my game but im not sure if this is the best way, can I get some feedback?

function maid:DoCleaning()
	for i, v in self do
		if typeof(v) == "RBXScriptConnection" then
			v:Disconnect()
			table.remove(self, i)
		end
	end
end

2 Likes

for Index, Connection in ipairs(self.Tasks) do

Why do you need to make a maid, when it’s already available, also use proper variable naming; don’t just use 1 letter on variables, make it so that it’s readable, so when ever you want to read your code you’ll be able to understand what it means and not just for you but others aswell.

I don’t get why everyone is so against 1 variable code names such as “i, v” or “k, o”. I bet you 70% of coders will read these two names and instantly think “index, value” or “key, object”. Also, I don’t like using pre-made modules because when I make a game it has to be 100% made by me or else ill feel like im “cheating” or doing something wrong in a sense.

I don’t think the problem here is that the variables are one letter, it’s that you could be a lot more specific which your variable names, like what @xDeltaXen suggested.

You aren’t cheating or doing anything wrong by using a pre-made module, you still need to figure out how to use it effectively. If you’re still learning, it’s probably fine to try to make something on your own, but if you’re making a full on game, probably best not to make something that has already been done.

Another suggestion: It might be useful to have it be able to clean up other stuff like instances and even other objects.

Study How the module works, or try to make your own based on that module. It is not cheating at all if you use someone elses modules because you cannot script everything in roblox, you can only learn from the best in that section.

Study it, if you understand how it works it will not feel like cheating anymore. You then understand what it does, it will be like you wrote it yourself.

Cya comrad, :wink: