I want to make character’s right arm to look in direction mouse is pointing at. the issue is, no matter what method I use, I don’t get the result I need. from spinning 360 degrees during walking or getting joints deformed to getting flinged beyond INF coordinates. how to make it work? I’ve spent many hours for just one small script
I removed arm code lines because they aren’t working anyways
local Players = game:GetService("Players")
local RunService = game:GetService("RunService")
local LocalPlayer = Players.LocalPlayer
local mouse = LocalPlayer:GetMouse()
local tool = script.Parent
tool.Equipped:Connect(function()
local character = LocalPlayer.Character or LocalPlayer.CharacterAdded:Wait()
local humanoidRootPart = character:FindFirstChild("HumanoidRootPart")
local torso = character:FindFirstChild("Torso")
if not humanoidRootPart or not torso then return end
local rightArm = torso:FindFirstChild("Right Shoulder")
local head = torso:FindFirstChild("Neck")
if not rightArm or not head then return end
local defaultRightArmC0 = rightArm.C0
local defaultHeadC0 = head.C0
local watchCursor
watchCursor = RunService.RenderStepped:Connect(function()
local mouseHit = mouse.Hit
if mouseHit then
local rootPos = humanoidRootPart.Position
local targetPos = Vector3.new(mouseHit.Position.X, rootPos.Y, mouseHit.Position.Z)
local lookAtCFrame = CFrame.lookAt(rootPos, targetPos)
humanoidRootPart.CFrame = lookAtCFrame
end
end)
script.Parent.Unequipped:Wait()
watchCursor:Disconnect()
end)