How would I be able to allow my character to aim up and down depending on mouse location?
Example: Mouse in top right corner allows the character to aim in the top right direction.
How would I be able to allow my character to aim up and down depending on mouse location?
Example: Mouse in top right corner allows the character to aim in the top right direction.
local Player = game:GetService("Players")
local player = Player.LocalPlayer
local Character = player.Character or player.CharacterAdded:Wait()
local mouse = player:GetMouse()
local pp = Character.HumanoidRootPart
while wait() do
pp.CFrame = CFrame.new(pp.Position, Vector3.new(mouse.Hit.p.X, pp.Position.Y, mouse.Hit.p.Z)) -- If you want a in-depth cframe tutorial on what this line does click the link below
end
If you want the script to work in server you’ll place the same thing but either use remoteEvent or a RemoteFunction to get mouse to the server.
While this was not what I wanted, I edited the script to help aim with only the X and Y axis. Its getting close, but not that good.
After a lot of blood, sweat, and tears, i have finally made it so i can aim on 2 axis after using your answer and this guide.