Hello, Im kind of new to Cframe and I’ve been trying to make my turret face towards the mouse for the past few days.
I have made a code but it doesn’t work
Here is my current setup:
- I have a LocalScript with this code set to run.
local player = game.Players.LocalPlayer local mouse = player:GetMouse() local TurretUnion = game.Workspace.Turret.TurretS while wait() do TurretUnion.CFrame = TurretUnion.CFrame * CFrame.Angles(math.asin((mouse.Hit.Position - mouse.Origin.Position).Unit.Y), 0, 0) end
I tried to make a loop that detects the mouse position and faces the turret towards it, however something doesn’t work.
-Hope you can help