How to make something in a billboardGui point to the players mouse

Hello, I am currently stuck on making a GUI object in a BillboardGui point to the mouse.
I have the pointing to the mouse somewhat working but it doesn’t go all the way it only moves slightly.
Here is the file for the place and a video of what is happening:
MousePoint.rbxl (21.9 KB)
https://gyazo.com/6b02a7a109acabab638777468fb47980

Here is a quick fix.

First, set the BillboardGui’s adornee to PartCool in workspace. Then, use this code.

script.Parent.Adornee = game.Workspace.PartCool		-- Set the adornee on the client so pointing to the mouse is possible

local Player = game.Players.LocalPlayer
local Mouse = Player:GetMouse()
local Camera = game.Workspace.CurrentCamera



game:GetService("RunService").RenderStepped:connect(function()
	local PartScreenPos = Camera:WorldToScreenPoint(game.Workspace.PartCool.Position)
	PartScreenPos = Vector2.new(PartScreenPos.X, PartScreenPos.Y)
	local MouseScreenPos = Vector2.new(Mouse.X, Mouse.Y)
	local Direction = (MouseScreenPos - PartScreenPos).Unit
	local Frame = script.Parent.PointImage
	local TheRotation = math.deg(math.atan2(Direction.Y, Direction.X))
	
	Frame.Rotation = TheRotation
end)
1 Like