Hello, I have a directions frame/compass kind of like rust. I have got the camera angle of the player from 0 - 360.
I have 2 frames, Base and Frame. Base has Clip descendants on, Frame doesn’t but it has all the elements.
How can I make the frame move to display the current angle / direction the player is facing
local player = game.Players.LocalPlayer
local camera = workspace.CurrentCamera
local Gui = script.Parent
local Window, Compass = Gui.Window, Gui.Base
-- Compass has clip on, Compass.Frame doesn't (Compass.Frame has all the elements)
local function getCameraAngle()
local cameraCFrame = camera.CFrame
local lookVector = cameraCFrame.LookVector
local angle = math.atan2(-lookVector.X, -lookVector.Z)
local degrees = math.deg(angle)
if degrees < 0 then
degrees = degrees + 360
end
degrees = math.floor(degrees)
local Frame = Compass.Frame
Frame.Position = UDim2.new(X, X, 0.5, 0)
warn(degrees)
end
camera:GetPropertyChangedSignal('CFrame'):Connect(getCameraAngle)