I have this piece of code that I am using to skip the process of making a viewmodel and instead use player’s actual arms. The problem is when I deattach the arms (Motor6D.Part1 = nil) the animation on the arms stops playing.
How do I resolve this?
Thanks.
local ROffset = CFrame.new(0.9,-0.9,0)
local LOffset = CFrame.new(-0.9,-0.9,0)
local camera = workspace.CurrentCamera
local head = script.Parent:WaitForChild("Head")
local function IsFirstPerson()
return (head.CFrame.p - camera.CFrame.p).Magnitude < 1
end
game:GetService("RunService").RenderStepped:Connect(function()
if IsFirstPerson() == true then
script.Parent["Right Arm"].LocalTransparencyModifier = 0.5
script.Parent["Left Arm"].LocalTransparencyModifier = 0.5
end
if script.Parent:FindFirstChildOfClass("Tool") ~= nil then
script.Parent["Right Arm"].CFrame = workspace.CurrentCamera.CFrame * ROffset
script.Parent["Left Arm"].CFrame = workspace.CurrentCamera.CFrame * LOffset
script.Parent.Torso["Left Shoulder"].Part1 = nil
script.Parent.Torso["Right Shoulder"].Part1 = nil
else
script.Parent.Torso["Left Shoulder"].Part1 = script.Parent["Left Arm"]
script.Parent.Torso["Right Shoulder"].Part1 = script.Parent["Right Arm"]
end
end)