My entity wont remove itself

Hello Facepunch users!

I cant get the entity i use to remove itself after use wich annoys the hell out of me. I tried multible things but i am helpless.
And if you know is it possible so it adds health? So instead of a max of 200 to just add 200 each time?
[lua]AddCSLuaFile(“cl_init.lua”)
AddCSLuaFile(“shared.lua”)
include(‘shared.lua’)

function ENT:Initialize()
self.Entity:SetModel(“models/starwars/items/bacta_large.mdl”)
self.Entity:PhysicsInit(SOLID_VPHYSICS)
self.Entity:SetMoveType(MOVETYPE_VPHYSICS)
self.Entity:SetSolid(SOLID_VPHYSICS)
self:SetUseType(SIMPLE_USE)

local phys = self.Entity:GetPhysicsObject()
self.nodupe = true
self.ShareGravgun = true

if phys and phys:IsValid() then phys:Wake() end
self:SetCollisionGroup(COLLISION_GROUP_INTERACTIVE_DEBRIS) 

end

function ENT:SpawnFunction(ply, tr)
if (!tr.Hit) then
return end

local SpawnPos = tr.HitPos + tr.HitNormal

local ent = ents.Create("sw_health")
ent:SetPos(SpawnPos)
ent:Spawn()
ent:Activate()
 	 
return ent 

end
[/lua]

You should show us all the files.

cl_init.lua
[lua]include(“shared.lua”)
function ENT:Draw()
self:DrawModel()
end[/lua]

init.lua
[lua]AddCSLuaFile(“cl_init.lua”)
AddCSLuaFile(“shared.lua”)
include(‘shared.lua’)

function ENT:Initialize()
self.Entity:SetModel(“models/starwars/items/bacta_large.mdl”)
self.Entity:PhysicsInit(SOLID_VPHYSICS)
self.Entity:SetMoveType(MOVETYPE_VPHYSICS)
self.Entity:SetSolid(SOLID_VPHYSICS)
self:SetUseType(SIMPLE_USE)

local phys = self.Entity:GetPhysicsObject()
self.nodupe = true
self.ShareGravgun = true

if phys and phys:IsValid() then phys:Wake() end
self:SetCollisionGroup(COLLISION_GROUP_INTERACTIVE_DEBRIS) 

end

function ENT:SpawnFunction(ply, tr)
if (!tr.Hit) then
return end

local SpawnPos = tr.HitPos + tr.HitNormal

local ent = ents.Create("sw_health")
ent:SetPos(SpawnPos)
ent:Spawn()
ent:Activate()
 	 
return ent 

end

function ENT:Use(plyUse)
plyUse:SetHealth(200)
end

function ENT:OnRemove()
self:Remove()
end
[/lua]

shared.lua
[lua]DEFINE_BASECLASS( “base_gmodentity” )

ENT.PrintName = “Small Becta Kit(250 HP)”
ENT.Author = “boxvader”
ENT.Information = “Heals you to 200 health”
ENT.Category = “Star Wars Health”

ENT.Editable = false
ENT.Spawnable = true
ENT.AdminOnly = false[/lua]

In ENT:Use you should remove the entity if you want it to be single use.

A simple self.Entity:Remove() should do in there.

Thanks!, Now how do i get it to heal 200HP per use and not a max of 200?

plyUse:SetHealth(plyUse:Health() + 200)

to increment by 200 each use

self.Entity is deprecated

Thanks alot! i was strugling to make this work haha

Seriously -_- I should never have given you anything considering you didn’t try to do any of this yourself. I went out of my way to try and help you hoping that you would learn some thing instead you came right back here to get other people to do your work. Read a damn wiki page it’s not that hard and would have explained how to do this.