i dont see whats a problem with
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 RootPos, MousePos = Root.Position, Mouse.Hit.Position
Root.CFrame = CFrame.new(RootPos, Vector3.new(MousePos.X, RootPos.Y, MousePos.Z))
end)
this is my full code replicating this in a empty baseplate
local RunService = game:GetService("RunService")
local camera = workspace.CurrentCamera
local player = game.Players.LocalPlayer
local Root = player.Character:WaitForChild("HumanoidRootPart")
local Mouse = player:GetMouse()
local CAMERA_OFFSET = Vector3.new(-1,90,0)
local CframeLerp = CFrame.new()
camera.CameraType = Enum.CameraType.Scriptable
local function onRenderStep(DT)
if player.Character then
local playerPosition = player.Character.HumanoidRootPart.Position
local cameraPosition = playerPosition + CAMERA_OFFSET
local RootPos, MousePos = Root.Position, Mouse.Hit.Position
Root.CFrame = CFrame.LookAt(RootPos, Vector3.new(MousePos.X, RootPos.Y, MousePos.Z))
camera.CFrame = CFrame.new(cameraPosition, playerPosition)
end
end
RunService:BindToRenderStep("Camera", Enum.RenderPriority.Camera.Value, onRenderStep)
maybe you have something interfering with the script above
2 comments
I don't really understand what do you mean cause I don't know what a top down is but if you just want to make the characters head to look into the mouse location then you need to make a head variable and use it instead of the root part right? However if you want the character body then it will be hard
Try to use an orientation instead or position. not sure but I think you need a hard mathematics sine position and orientation aren't the same..