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

How to remove someone from a table useing there name?

Ok so iv been trying for hours this is all i could do D: please help!

function unminion(part)
	if part.Parent == p.Character then return end
			if part.Parent:FindFirstChild("Humanoid") ~= nil then
	v = part.Parent.Name
	for i,x in pairs(minions) do
		if (string.upper(v) == string.upper(x)) then
			table.remove(x,v)
		end
	end
end
end

5 comments

0

What is the table here?

0

This is just the function part the table is minions

0

Instead of "v" on line 7, try "i", to index the "minions" table & remove that value.

0

No that didnt work D:

1

Oops, the first parameter of the "remove" method for the "table" class should be a table value. So try "table.remove(minions, i).

1 answer

If you're going to remove something from minions, you would expect to see minions somewhere in the table.remove line.

Based on looking up what table.remove wants, it would be

table.remove(minions, i) -- as opposed to `v`

Tab your code correctly. Other cleanliness things might include using

			if v:upper() == x:upper() then

instead of

			if (string.upper(v) == string.upper(x)) then

Also remember to always use local variables; v isn't called local.

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