Using players arms to make a viewmodel

could you elaborate (I’m stupid)

also, wouldn’t that just move the whole character?

(hopefully that works)

ok well actually that talks about rotation the camera

just do like

RightShoulder.C0 = RightShoulder.C0 * CFrame.Angles(Camera.CFrame.Rotation)

image

Oh wait im stupid

RightShoulder.C0 = RightShoulder.C0 * Camera.CFrame.Rotation

forgot that thats already a CFrame angle

image
I don’t think that will move it to the camera.

also, when I go into first person it just spins.

See if this forum can help.

ok wait lemme see rq
aaaaaaaaaaaaa

oh yeah uh

RightShoulder.C0 = RightShoulder.C0.Position + CFrame.Angles(Camera.CFrame.Rotation)

argument 3 missing or nil has happened

I don’t want to clone the arms, I want to use the arms.

yea no i made the mistake again, remove the “CFrame.Angles”

invalid argument. I’m messing with values to see If I can get it to work

I do wanna say though. I see what you are trying to do but when looking up in first person the tool comes very close to the screen

wait what

no like RightShoulder.C0 = RightShoulder.C0.Position + Camera.CFrame.Rotation

(also whats the specific error?)

that’s what I have

also I already have code that makes the arms face the same direction as the camera. I just need them to line up

I need the arms to be a bit more back

ok what is the code that you’re using rn?

also

RightShoulder.C0 = CFrame.new(RightShoulder.C0.Position) + Camera.CFrame.Rotation```

server side: (so everyone can see there are looking up)

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local ArmsEvent = ReplicatedStorage.ArmsEvent

game.Players.PlayerAdded:Connect(function(player)
  player.CharacterAdded:Connect(function(character)
    local RenderService = game:GetService("RunService")
    local ToolMotor = Instance.new("Motor6D")
    ToolMotor.Parent = character:WaitForChild("HumanoidRootPart")
    local mousePosition = Vector3.new(0, 0, 0)

    ArmsEvent.OnServerEvent:Connect(function(plr, position)
      if plr == player then
        mousePosition = position
      end
    end)

	local RightShoulder, LeftShoulder, ToolGrip = character.UpperTorso:WaitForChild("RightShoulder"), character.UpperTorso:WaitForChild("LeftShoulder"), ToolMotor

    RenderService.Heartbeat:Connect(function()
      local X = -(math.asin((character.HumanoidRootPart.Position - mousePosition).unit.y))

      local _, Y, Z = RightShoulder.C0:ToEulerAnglesXYZ()
      local OldRightC0 = RightShoulder.C0
      RightShoulder.C0 = CFrame.new(RightShoulder.C0.Position) * CFrame.Angles(X, Y, Z)
      local Difference = OldRightC0.Position - RightShoulder.C0.Position

      local _, Y, Z = ToolGrip.C0:ToEulerAnglesXYZ()
      ToolGrip.C0 = CFrame.new(ToolGrip.C0.Position) * CFrame.Angles(X, Y, Z)

      local _, Y, Z = LeftShoulder.C0:ToEulerAnglesXYZ()
      LeftShoulder.C0 = CFrame.new(LeftShoulder.C0.Position) * CFrame.Angles(X, Y, Z)
    end)
  end)
end)

Am I just gonna have to use a view model?

did you try the new line of code I gave?

and also, can’t you just rip the arms off and use that as the viewmodel?

HOL UP:

I just realized I could disable the waist motor 6D. it still gives animation but doesn’t pull the character.
gg!


code: has bugs and tweaking needed but it works!

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local RunService = game:GetService("RunService")

local Character = script.Parent
local Humanoid = Character:FindFirstChildWhichIsA("Humanoid")
local Camera = workspace.CurrentCamera
local Player = game.Players.LocalPlayer
local Events = ReplicatedStorage.Events

local mouse = Player:GetMouse()


local UpperTorso = Character:FindFirstChild("UpperTorso")
local RightShoulder = Character:FindFirstChild("UpperTorso").RightShoulder
local Waist = Character:FindFirstChild("UpperTorso").Waist
Waist.Enabled = false
UpperTorso.CanCollide = false
RunService.RenderStepped:Connect(function()
	if Waist:IsA("Motor6D") then
		UpperTorso.CFrame = Camera.CFrame
	end
	for i, part in pairs(Character:GetChildren())do
		if string.match(part.Name, "Arm")or string.match(part.Name, "Hand") then
			part.LocalTransparencyModifier = 0
		end
	end
end)
1 Like

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