Hey guy’s the title say’s all…
-I’ve been trying to make a Drugs for a new system im making. so far, none of my code has worked except for setting the model and setting the health and the spark-effect when destroyed.
this is supposed to give you +100 health, decreasing slowly, a small speed boost, and some more jumping power.
Everything seems to work, but the gamemode spams me with:
Error: [gamemodes\darkrp\entities\entities\drugs\init.lua:36] attempt to index global 'D' (a nil value)
I’ve been looking on the code i don’t see any Error’s but there is one, so i hope you guy’s can figure this out for me, in advance thanks!
[lua]function Drugged( ply )
local IDSteam = string.gsub(ply:SteamID(), “:”, “”)
if not timer.IsTimer(IDSteam…“DruggedHealth”) and not timer.IsTimer(IDSteam) then
ply:SetHealth(ply:Health() + 100)
timer.Create(IDSteam…“DruggedHealth”, 60/(100 + 5), 100 + 5, function()
if ValidEntity(ply) then D:SetHealth(ply:Health() - 1) end
if ply:Health() <= 0 then ply:Kill() end
timer.Create(IDSteam, 60, 1, undrugged, ply)