So, I've been trying to work on a horror game that follows similar mechanics to Amnesia: The Dark Decent.
Atm I've been trying to work on a door and drawer system, such as where you click on the door to open it, and you move your mouse to show how much you want it open. This follows the same with a drawer opening system, where you click, hold, and move your mouse to position how much you want it open, or closed.
I've been having trouble with this, as I haven't been able to get this to work properly, and I also haven't been able to get a max rotation value so the door/drawer doesn't go past its limits.
This is the code I have so far, which I don't think is even the right way to do it:
local Mouse = game.Players.LocalPlayer:GetMouse() local klik = false local prev_mousehit Mouse.Button1Up:connect(function() klik = false end) Mouse.Button1Down:connect(function() klik = true end) Mouse.Move:connect(function() if klik == true and Mouse.Hit.p ~= prev_mousehit then game.Workspace.Model.Main.CFrame = game.Workspace.Model.Main.CFrame * CFrame.Angles(0, -Mouse.X / 80, 0) prev_mousehit = Mouse.Hit.p end end)