As you can see there’s a small rotation for the bar but it’s not working entirely. It only rotates a small bit instead of entirely rotating to face the mouse. The code is below, currently, I’m using math.atan2.
local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
game:GetService("RunService").Stepped:Connect(function()
local x = math.atan2(mouse.X,mouse.Y)
playergui:WaitForChild("testGui").Frame.Rotation = x
end)
local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
local playergui = game.Players.LocalPlayer.PlayerGui
game:GetService("RunService").Stepped:Connect(function()
local frame = playergui:WaitForChild("testGui").Frame
local frameCenter = frame.AbsolutePosition + (frame.AbsoluteSize/2)
local x = math.atan2(mouse.Y - frameCenter.Y, mouse.X - frameCenter.X)
frame.Rotation = math.deg(x)
end)
local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
local playergui = game.Players.LocalPlayer.PlayerGui
game:GetService("RunService").Stepped:Connect(function()
local frame = playergui:WaitForChild("testGui").Frame
local frameCenter = frame.AbsolutePosition + (frame.AbsoluteSize/2)
local x = math.atan2(mouse.Y - frameCenter.Y, mouse.X - frameCenter.X)
frame.Rotation = math.deg(x) + 90
end)