How do i make the limb wielding the tool look forward?

I almost got the arms to follow the camera correctly but i think the arms that are supposed to be animated or posed are just posed very weirdly.


I couldn’t really figure out a way to fix this problem yet so yeah.

Here are the codes

CLIENT

local plr = game.Players.LocalPlayer
local cam = workspace.CurrentCamera

game:GetService("RunService").RenderStepped:Connect(function(delta)
	local char = plr.Character
	
	if char then
		for i,part in pairs(char:GetChildren()) do
			if part:IsA("BasePart") then
				if part.Name == "Left Arm" or part.Name == "Right Arm" or part.Name == "Left Leg" or part.Name == "Right Leg" then
					part.Transparency = 0
					part.LocalTransparencyModifier = 0
				end
			end
		end
	end
	
	game.ReplicatedStorage.Eventsandfunctions:WaitForChild("Mousefollowevent"):FireServer(cam.CFrame.LookVector.Y)
end)

SERVER

local rightshoulder = script.Parent.Parent:WaitForChild("Torso"):WaitForChild("Right Shoulder")
local leftshoulder = script.Parent.Parent:WaitForChild("Torso"):WaitForChild("Left Shoulder")
local oldright = rightshoulder.C0
local oldleft = leftshoulder.C0

game.ReplicatedStorage.Eventsandfunctions:WaitForChild("Mousefollowevent").OnServerEvent:Connect(function(plr, camY)
	local tool = plr.Character:FindFirstChildOfClass("Tool")
	
	local function rotate(shoulder, orientation)
		local scov = shoulder.C0.Position

		shoulder.C0 = CFrame.new(shoulder.C0.Position) * CFrame.Angles(orientation,0,0)
	end


	if tool and tool:FindFirstChild("IsAGun") or tool and tool:FindFirstChild("Isamelee") then
		rotate(rightshoulder, camY)
		rotate(leftshoulder, camY)
	else
		rightshoulder.C0 = oldright
		leftshoulder.C0 = oldleft
	end
end)

Ok i scripted the code differently this time and now it works properly

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