Player MetaTable updates everybody..?

Hello.

I don’t know what’s wrong with this, but whenever I run this function, it updates not on the specified player, but on every player in the server:



	local meta = FindMetaTable("Player")

	meta.Items = {}

	function meta:GiveItem(item, amount)
		local itement = ents.Create(item)
		local uid = table.Count(self.Items) + 1
		if not self:HasItem(item) then
			self.Items[item] = {['entity'] = itement, ['equipped'] = false, ['amount'] = amount or 1, ['uid'] = uid, ['printname'] = Item.Registered[item].name, ['model'] = Item.Registered[item].model}
		else
			self.Items[item] = {['entity'] = itement, ['equipped'] = false, ['amount'] = amount + self.Items[item].amount or 1, ['uid'] = uid, ['printname'] = Item.Registered[item].name, ['model'] = Item.Registered[item].model}
		end

	end



I’ve tried doing everything I can think of, it keeps on running the code on everybody in the server. Help!

Well that’s what it’s supposed to do.
The items table is defined for every instance of the player class. Try defining it as self.items = {} inside the func.

[editline]7th March 2014[/editline]

Actually wait a second, now that I think about it it should still work like that

Yeah, i’m not quite sure what to think or do about it. i’ve spent a day on this and still no luck

[editline]8th March 2014[/editline]

Actually, what you said worked, I set up the player’s item table on PlayerInitialSpawn.