Save props function problem.

Hey, i’m trying to make saving the players props on a .txt file.
Every 5 min, the server runs this function.
In my txt file, i have “props=


function PlayerMeta:SaveCharacter()
	if ( !file.IsDir( "test", "DATA" ) ) then file.CreateDir( "test" ) end
	if ( !file.IsDir( "test/saves", "DATA" ) ) then file.CreateDir( "test/saves" ) end
	if ( !self.Loaded ) then
		print( "Player " .. self:Name() .. " tried to save before he has loaded!" )
		self:SendMessage( "Character save failed: Not yet loaded!", 3, Color( 255, 50, 50, 255 ) )
		return
	end

	local tbl = {}
	tbl["date"] = os.date( "%A %m/%d/%y" )
	tbl["name"] = self:Nick()
	tbl["skills"] = self.Skills
	tbl["props"] = {}

	for id, ent in pairs( ents.GetAll() ) do
		if ( ent:GetOwner() == self.Owner ) then
			table.insert( tbl[ "props" ], ent:GetClass() )
		end
	end

	file.Write( "test/saves/" .. self:UniqueID() .. ".txt", util.TableToJSON( tbl ) )
	self:SendMessage( "Saved character!", 3, Color( 255, 255, 255 ) )
end

Thanks a lot !

you shouldn’t have those file isdir there, they should be checked once on server start,
where is self.loaded?
What is not working?

if ( ent:GetOwner() == self.Owner ) then
i think you need to check owner == self, since you are in the plymeta.
but im not sure and a bit tired.

Thanks a lot !
It’s working.

Do not use Self.Ower but just self