Trying to make r6 arm follow mouse

hello! im trying to make a r6 characters arm follow the mouse. i tried different things and eventually i got something but its obviously not working… im trying to make it something similar to breaking point where the arms follow the cursor but i have no idea how to do it. ty :slight_smile:

gif:
https://gyazo.com/e370289a38cc53419dabf6878049f690

heres my script:

local rs = game:GetService("RunService")
local cam = workspace.CurrentCamera
local plr = game.Players.LocalPlayer
local mouse = plr:GetMouse()
local char = plr.Character
local rightArm = char["Right Arm"]
local rightshoulder:Motor6D = char.Torso["Right Shoulder"]
local x = rightshoulder.C0.X
local y = rightshoulder.C0.Y
local z = rightshoulder.C0.Z

rs.RenderStepped:Connect(function()
	local mouseHit = mouse.Hit
	


	rightshoulder.C0 = CFrame.Angles(math.floor(90),0,0) * (mouse.Hit.Rotation) 
rightshoulder.DesiredAngle = 90
rightshoulder.CurrentAngle = math.rad(90)

end)
1 Like

I have a script that does that. It was originally for r15 but i modified it (works for both 3rd person and fps), Hope it helps although its only client sided and only up and down since you move side to side anyways in fps. im currently finding a way for it to be also server sided, ill update you if i ever succeed in making one.

plr = game.Players.LocalPlayer;
repeat
	wait()
until plr.Character
char = plr.Character
m = plr:GetMouse()
local IsEquipped = false


local origRightS = char:WaitForChild("Torso"):WaitForChild("Right Shoulder").C0
local origLeftS = char:WaitForChild("Torso"):WaitForChild("Left Shoulder").C0
local origNeck = char:WaitForChild("Torso"):WaitForChild("Neck").C0
local camera = game.Workspace.CurrentCamera

local UIS = game:GetService("UserInputService")
local c = game.Workspace.CurrentCamera

game:GetService("RunService").RenderStepped:Connect(function(delta)

	if IsEquipped == true then
		if char.Torso:FindFirstChild("Right Shoulder") then
			char.Torso["Right Shoulder"].C0 = char.Torso["Right Shoulder"].C0:Lerp(CFrame.new(1, .65, 0) * CFrame.Angles(-math.asin((m.Origin.p - m.Hit.p).unit.y), 1.55, 0, 0) , 0.4)
		end
		if char.Torso:FindFirstChild("Left Shoulder") then
			char.Torso["Left Shoulder"].C0 = char.Torso["Left Shoulder"].C0:Lerp(CFrame.new(-1, .65, 0) * CFrame.Angles(-math.asin((m.Origin.p - m.Hit.p).unit.y), -1.55, 0, 0) , 0.4)
		end
		if char.Torso:FindFirstChild("Neck") then
			char.Torso["Neck"].C0 = char.Torso["Neck"].C0:Lerp(CFrame.new(0, 1, 0) * CFrame.Angles(-math.asin((m.Origin.p - m.Hit.p).unit.y) + 1.55, 3.15, 0), 0.4)
		end

	else

		if char.Torso:FindFirstChild("Right Shoulder") then
			char.Torso["Right Shoulder"].C0 = char.Torso["Right Shoulder"].C0:lerp(origRightS, 0.4)
		end

		if char.Torso:FindFirstChild("Left Shoulder") then
			char.Torso["Left Shoulder"].C0 = char.Torso["Left Shoulder"].C0:lerp(origLeftS, 0.4)
		end

		if char.Torso:FindFirstChild("Neck") then
			char.Torso["Neck"].C0 = char.Torso["Neck"].C0:lerp(origNeck, 0.4)
		end
	end
end)


char.ChildAdded:Connect(function(instance)
	for i,v in pairs(char:GetChildren()) do
		if v:IsA("Tool") then
			if v:FindFirstChild("HoldArmsStill") then
			else
				IsEquipped = true
			end
		end
	end
end)

char.ChildRemoved:Connect(function(instance)
	if instance:IsA("Tool") then
		IsEquipped = false
	end
end)
4 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.