Hello!
You can make it with onClientClick event.
Here is an example code:
local showDX = false
function Click(btn, state, x, y, wx, wy, wz, obj)
if (obj == nil) then return end
if (isElement(obj)) then
if (getElementType(obj) == "player" then
showDX = true
end
end
end
addEventHandler("onClientClick", getRootElement(), Click)
function render()
if (showDX) then
-- Write here the DX lines
end
end
addEventHandler("onClientRender", getRootElement(), render)
I hope I can help you!