I’ve been trying out a method of drawing entities near the player by comparing the X and Z distances between the entity and LocalPlayer(), it works fine however I receive massive FPS drop because I’m technically not getting rid of the text when the distance is further than the limit of (500). Thus I easily lose around 20-30 FPS. So, the real question is - besides removing the hook or setting the color as 0, 0, 0, 0 how would I get rid of the text? I think removing the hook will remove every text object located with that function. Essentially this works, but at the expense of 20 FPS.
By the way, outlineVar was just a way of changing the color depending on if I required an outline for that text or not (in this case I did)
function findDist( varA, varB, outlineVar )
if varA < 500 and varB < 500 and outlineVar == 0 then
return Color ( 255, 246, 10, 255 )
else if varA < 500 and varB < 500 and outlineVar == 1 then
return Color ( 0, 0, 0, 255 )
else
return Color ( 0, 0, 0, 0 )
end
end
end
function drawEntText()
if !bool then return end
local getLPos = LocalPlayer():GetPos()
for _,v in pairs( getAllEnt() ) do
if v:IsValid() then
local getEntPos = v:GetPos():ToScreen()
local getFullPos = v:GetPos()
local relativePosX = getFullPos.x - getLPos.X
local relativePosY = getFullPos.Y - getLPos.Y
createText( v:GetClass(), "Default", getEntPos.x, getEntPos.y, findDist( relativePosX, relativePosY, 0 ), 0, 0, 1, findDist( relativePosX, relativePosY, 1 ) )
end
end
end
I don’t even know if this is a good way of calculating distance either - so any input would be well appreciated.