Trying to move arms with tools (FirstPerson R6 only)

I was looking for make something like this:

The problem is R6 doesnt have Motor6D inside the head Neck and doesnt have Motor6D inside the Torso

Image: (This is R15)


image

And I was trying to know if is possible to make the arms and head and the Torso move with tools in first person with R6 without using this the Motor6D

Ok so I tried to make something like:

local run = game:GetService("RunService")
local tool = script.Parent
local equipped = false
local Player = game.Players.LocalPlayer
local mouse = Player:GetMouse()
local char = Player.Character

tool.Equipped:Connect(function()
	equipped = true
end)

run.RenderStepped:Connect(function()
	
	if equipped then
		local rightX, rightY, rightZ = char.Torso["Right Shoulder"].C0:ToEulerAnglesYXZ()
		char.Torso["Right Shoulder"].C0 = (char.Torso["Right Shoulder"].C0 * CFrame.Angles(0, 0, -rightZ)) * CFrame.Angles(0, 0, math.asin((mouse.Hit.p - mouse.Origin.p).unit.y))

		local leftX, leftY, leftZ = char.Torso["Left Shoulder"].C0:ToEulerAnglesYXZ()
		char.Torso["Left Shoulder"].C0 = (char.Torso["Left Shoulder"].C0 * CFrame.Angles(0, 0, -leftZ)) * CFrame.Angles(0, 0, math.asin((-mouse.Hit.p - -mouse.Origin.p).unit.y))
	end
end)

But I am getting this error

image

Note: Is not main script is local

I found an easy fix!

change
local char = Player.Character
to
local char = Player.Character or Player.CharacterAdded:Wait()

Here is the result:

3 Likes

Thank you it works

Now I got other problem…

I am using Motor6D animations

The problem is…

I think I need to make one Motor6D for each arm and connect it to the ToolGrip

Basicly the animation setup works like this:

**ServerSide**

game.Players.PlayerAdded:Connect(function(plr)			
	plr.CharacterAdded:Connect(function(char)

		local M6D = Instance.new("Motor6D")
		M6D.Name = "ToolGrip"
		M6D.Parent = char.Torso
	end)
end)

game.ReplicatedStorage.ConnectM6D.OnServerEvent:Connect(function(plr,location)

	local char = plr.Character
	char.Torso:FindFirstChild("ToolGrip").Part0 = char.Torso
	char.Torso:FindFirstChild("ToolGrip").Part1 = location

end)

game.ReplicatedStorage.DisconnectM6D.OnServerEvent:Connect(function(plr)
	plr.Character.Torso:FindFirstChild("ToolGrip").Part0 = nil
	plr.Character.Torso:FindFirstChild("ToolGrip").Part1 = nil
end)

**Local Script**

tool.Equipped:Connect(function()
	----Animations----
	local char = plr.Character or plr.CharacterAdded:Wait()

	game.ReplicatedStorage.ConnectM6D:FireServer(tool.ToolsParts.BodyAttach)

	char.Torso.ToolGrip.Part0 = char.Torso
	char.Torso.ToolGrip.Part1 = tool.ToolsParts.BodyAttach

	local Humanoid = char:FindFirstChild("Humanoid")  
	idle = Humanoid:LoadAnimation(script:WaitForChild("Idle"))
	equipIdle = Humanoid:LoadAnimation(script:WaitForChild("EquipIdle"))
	Shoot1 = Humanoid:LoadAnimation(script:WaitForChild("Shoot"))
    idle:Play()

and I am using this script for the arms

I tested with one part (tool) just like you did the problem is I dont know how I can make this.

I can make one Motor6D for each arm and connect to the BodyAttach (the “Handle” for the tools) and the arms.

is this the for basic one first?

Nvm I alr fixed the problem.

How would you be able to make it so that it stops following your arms and they go back to their normal rotation/position when you enequip the tool?

What problem did you found? And can this also be on the server side if only a local script is used?

Do you know how to rotate camera in first person?

wdym first person camera rotate? it works on first person you can just use first person arms script like this:

On StarterCharacterScripts:

local player = game.Players.LocalPlayer
local char = player.Character
local head = char.Head
local camera = workspace.CurrentCamera
local RunService = game:GetService("RunService")

char.Humanoid.CameraOffset = Vector3.new(0, 0, -1.5)
player.CameraMaxZoomDistance = 0.4
camera.FieldOfView = 100

for i, v in pairs(char:GetChildren()) do
	if v:IsA("BasePart") and v.Name ~= "Head" then

		v:GetPropertyChangedSignal("LocalTransparencyModifier"):Connect(function()
			v.LocalTransparencyModifier = v.Transparency
		end)

		v.LocalTransparencyModifier = v.Transparency

	end
end

RunService.RenderStepped:Connect(function(step)
	local ray = Ray.new(head.Position, ((head.CFrame + head.CFrame.LookVector * 2) - head.Position).Position.Unit)
	local ignoreList = char:GetChildren()

	local hit, pos = game.Workspace:FindPartOnRayWithIgnoreList(ray, ignoreList)

	if hit then
		char.Humanoid.CameraOffset = Vector3.new(0, 0, -(head.Position - pos).magnitude)
	else
		char.Humanoid.CameraOffset = Vector3.new(0, 0, -1)
	end
end)

Here this is what I mean about camera How could I make your arms and head follow your mouse up and down? - #40 by Bikereh

can this also work on server side?

if you use one local script and send into the server side with RemoteEvents like I did yes. You can make it work

Guys, I just edited the script. When you unequip it will go back to the default pose or old rotation of the arms.
This is the code I make for myself. But the problem is that the camera does not rotate. I mean, like this problem How could I make your arms and head follow your mouse up and down? - #40 by Bikereh? u=jando_123456

So this is the code now. I hope it helps.

local run = game:GetService("RunService")
local tool = script.Parent
local equipped = false
local Player = game.Players.LocalPlayer
local mouse = Player:GetMouse()
local char = Player.Character

local DefaultRightArm = char:WaitForChild('Torso'):WaitForChild('Right Shoulder').C0
local DefaultLeftArm = char:WaitForChild('Torso'):WaitForChild('Left Shoulder').C0

tool.Equipped:Connect(function()
	equipped = true
end)

tool.Unequipped:Connect(function()
	equipped = false
	char:WaitForChild('Torso'):WaitForChild('Right Shoulder').C0 = DefaultRightArm
	char:WaitForChild('Torso'):WaitForChild('Left Shoulder').C0 = DefaultLeftArm
end)

run.RenderStepped:Connect(function()
	mouse.TargetFilter = game.Workspace
	if equipped == true then
		local rightX, rightY, rightZ = char:WaitForChild('Torso'):WaitForChild('Right Shoulder').C0:ToEulerAnglesYXZ()
		char:WaitForChild('Torso'):WaitForChild('Right Shoulder').C0 = (char.Torso["Right Shoulder"].C0 * CFrame.Angles(0, 0, -rightZ)) * CFrame.Angles(0, 0, math.asin((mouse.Hit.p - mouse.Origin.p).unit.y))

		local leftX, leftY, leftZ = char.Torso["Left Shoulder"].C0:ToEulerAnglesYXZ()
		char:WaitForChild('Torso'):WaitForChild('Left Shoulder').C0 = (char.Torso["Left Shoulder"].C0 * CFrame.Angles(0, 0, -leftZ)) * CFrame.Angles(0, 0, math.asin((-mouse.Hit.p - -mouse.Origin.p).unit.y))
	end
end)

--Code original by: ToxicalGamer2006
--Code edited by: Jando_123456

well, do you have a script for it? Because when I make it myself it has an error and I’m not yet professional do you know about this? How could I make your arms and head follow your mouse up and down? - #40 by Bikereh

How to fix that? Your tool rotates with the arms?