Issue spawning ents from table.

I’m looking to create code that spawns a random entity (that i have already created) onto a specific location on the map every 20 seconds.

I can’t seem to get this to work, I’ve tried placing the table in different files and referencing it from other places but that doesn’t seem to work. Here’s my code.

autospawnitems.lua (autorun/autospawnitems.lua)




	ItemTable = {}
	ItemTable[ 1 ] = "watermelon"
	ItemTable[ 2 ] = "milk"


	
	
-- name of timer, seconds, reps ( 0 == inf )	
timer.Create("SpawnTimer", 20, 0, function()
	local RandomItem = ents.Create(table.Random( ItemTable ))
        RandomItem:SetPos( -163.036514, 1136.728516, 192.031250 )
        RandomItem:SetAngle( 0.880016, 89.859520, 0.000000 )
        RandomItem:Spawn()
end)


the entity file(s). They’re both the same other then the model and display name.
milk.lua (mygamemode/entities/entities/milk.lua)



AddCSLuaFile()

ENT.Type	=	"anim" -- allows movement/interaction
ENT.Base	=	"base_gmodentity" -- give a base

ENT.PrintName	=	"Milk" 
ENT.Author		=	"Bitter"
ENT.Purpose		=	"Press 'USE' to pick up."
ENT.Instructions	=	"Press 'USE' to pick up."

ENT.Spawnable	=	false
ENT.AdminSpawnable	=	false


function ENT:Initialize()

	self:SetHealth( 100 )
	self:SetModel("models/props_junk/garbage_milkcarton001a.mdl")
	self:SetSolid( 0 ) -- or "SOLID_NONE"
	self:SetMoveType( MOVETYPE_NONE )
	
	local phs = self:GetPhysicsObject()
	if (phs:IsValid() ) then
	
		phs:Wake() -- wakes it up and makes it follow the physics i have set.
	
	end

end

function ENT:Draw()
	self:DrawModel() -- draw it for players to see :p
end

function ENT:Use( ply ) -- thing that touches the ent. player.
	if (ply:IsPlayer() ) then
	ply:Kill() -- for debugging.
	self:Remove() -- remove the ent
	
	end


end



error(s) in console:


[ERROR] lua/autorun/autospawnents.lua:16: attempt to call field 'Create' (a nil value)
  1. unknown - lua/autorun/autospawnents.lua:16

Timer Failed! [SpawnTimer][@lua/autorun/autospawnents.lua (line 15)]


Please note, I am ‘new’ to Lua coding. I’ve done it before to fix a few things here and there but i never took the time to actually sit down and learn it. I’m making a custom gamemode to -dive- right in because that’s how i learn best. I hope my lack of knowledge or what appears to be laziness doesn’t offend anyone.

Thanks in advance!

Solved it myself.