Making tracer-like esp for game objectives

  1. Hello! This may be my second post about creating a tracer esp but now I have moved 1 step forward!, I am extremely close to making a tracer esp and need just few guides to adjustments of the script.

  2. Here is the issue, there is a little offset issue which i find weird. But I feel like my code is right, it just needs adjustments. https://gyazo.com/7cf5d360c057ec021ed72b5d9efff1ad

  3. The code and reference is below. The floating part is where the tracer should be pointing

local lplr = game:GetService('Players').LocalPlayer
local cam = workspace.CurrentCamera
local Vectorasd, OnScreen = cam:WorldToViewportPoint(workspace:WaitForChild('viewcheck').Position)
local tov2 = Vector2.new(Vectorasd.X, Vectorasd.Y)
local fromv2 = Vector2.new(cam.ViewportSize.X / 2, cam.ViewportSize.Y / 1)
local thickness = 2
local LineProperties = {}
LineProperties.To = tov2
LineProperties.from = fromv2
game:GetService('RunService').RenderStepped:Connect(function()
	local tracer = script.Parent

	local Vector, OnScreen = cam:WorldToViewportPoint(workspace:WaitForChild('viewcheck').Position)

	-- tracer.From = Vector2.new(cam.ViewportSize.X / 2, cam.ViewportSize.Y / 2)
	
	coroutine.resume(coroutine.create((function()
		local To = Vector2.new(Vector.X, Vector.Y)
		local Direction = (To - LineProperties.From);
		local Center = (To + LineProperties.From) / 2
		local Distance = Direction.Magnitude
		local Theta = math.atan2(Direction.Y, Direction.X);

		tracer.Position = UDim2.fromOffset(Center.X, Center.Y);
		tracer.Rotation = math.deg(Theta);
		tracer.Size = UDim2.fromOffset(Distance, 1);

		LineProperties.To = To
	end)))
	coroutine.resume(coroutine.create((function()
		local From = Vector2.new(cam.ViewportSize.X / 2, cam.ViewportSize.Y / 2)
		local Direction = (LineProperties.To - From);
		local Center = (LineProperties.To + From) / 2
		local Distance = Direction.Magnitude
		local Theta = math.atan2(Direction.Y, Direction.X);

		tracer.Position = UDim2.fromOffset(Center.X, Center.Y);
		tracer.Rotation = math.deg(Theta);
		tracer.Size = UDim2.fromOffset(Distance, 1);

		LineProperties.From = From
	end)))
end)

Screen Shot 2022-09-09 at 2.34.33 PM

Why don’t you borrow some code from some exploits? It’s all open source and free to use.

That is a good idea, although “Drawing” is what I need, which I’m looking for the source code of it, I checked the script and it uses synapse Drawing api which I don’t have the source code of

The drawing library itself is not what you are looking for. Try finding the code that positions the lines and rotates them.

Offset solved by changing anchor point and reacting to screen size changes