How would I make the players character point towards the mouse?
I have no idea how I would do this really.
IF you are going to share cod please explain it
Have you considered researching if others have possibly answered your question? There are a couple of duplicate posts like the issue you mentioned
You’re close!
I’m assuming what you meant by ‘buggy’ is that the humanoid is trying to tilt to align with the mouse’s hit position while the humanoid is refusing at the same time due to built-in BodyGyro.
I’d make some slight changes to the code:
local Player = game.Players.LocalPlayer
local Character = Player.Character
local Root = Character.HumanoidRootPart
local Mouse = Player:GetMouse()
local RunService = game:GetService("RunService")
RunService.RenderStepped:Connect(function()
local R…
This better. took me 4 months to figure this out.
local Camera = game.Workspace.CurrentCamera
local player = game.Players.LocalPlayer
local Character = player.Character
local rootPart = Character:FindFirstChild("HumanoidRootPart")
local mouse = player:GetMouse()
local aim = false
local runService = game:GetService("RunService")
runService.RenderStepped:Connect(function()
if aim == true then
local rx, ry, rz = Camera.CFrame:ToOrientation()
rootPart.CFrame = CFrame.new(rootPart.CFrame.p) *…
This is simple. You can get the mouse position in a LocalScript like this:
local Mouse = game.Players.LocalPlayer:GetMouse()
local Position = Mouse.Hit.Position
And you can face the players character towards the Position like this:
character.HumanoidRootPart.CFrame = CFrame.new(character.HumanoidRootPart.Position, Position)
The first script gets the players mouse using :GetMouse(), and creates a variable called Position which is the position of the mouse in world space.
The second script ge…
All you’d just need to do is create some sort of RunService Loop so that the CFrame
of your Character can keep updating every client frame
3 Likes
Yeah I tried searching for those but I couldn’t find them, Thanks!
1 Like
system
(system)
Closed
January 28, 2023, 1:34am
#4
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.