Unfortunately fixing this issue is complicated as you are using 2 different systems, and I cant really explain much about it. The trick here is that you would want to replicate the weld system used on the character to the viewmodel. So once there is a viewmodel, you would want to change both the character and viewmodel’s weld properties.
I advised to just create your own viewmodel/first person system, as this is a hacky solution
Here is my system without modifying the viewmodel script:
Server Script
game.Players.PlayerAdded:Connect(function(plr)
plr.CharacterAdded:Connect(function(char)
local toolGrip = Instance.new("Motor6D")
toolGrip.Name = "ToolGrip"
toolGrip.Parent = char.Torso
char.ChildAdded:Connect(function(child)
if child:IsA("Tool") then
local bodyAttach = child:FindFirstChild("BodyAttach", true)
if bodyAttach then
toolGrip.Part0 = char.Torso
toolGrip.Part1 = bodyAttach
end
end
end)
char.ChildRemoved:Connect(function(child)
if child:IsA("Tool") then
toolGrip.Part1 = nil
end
end)
end)
end)
Local Script on StarterCharacterScripts
local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local torso = character:FindFirstChild("Torso")
local viewmodel
local camera = workspace.CurrentCamera
function setWelds()
print("viewmodel")
local toolGrip = torso:FindFirstChild("ToolGrip")
local toolGripVM = viewmodel.HumanoidRootPart:FindFirstChild("ToolGrip")
if not toolGripVM then
toolGripVM = Instance.new("Motor6D")
toolGripVM.Name = "ToolGrip"
toolGripVM.Parent = viewmodel.HumanoidRootPart
end
if toolGripVM and toolGrip then
print("toolgrip")
if not toolGrip.Part1 and character:FindFirstChildWhichIsA("Tool") then
toolGrip:GetPropertyChangedSignal("Part1"):Wait()
end
local bodyAttach = toolGrip.Part1
if bodyAttach then
print("bodyattach")
toolGrip.Part1 = nil
toolGripVM.Part0 = viewmodel.HumanoidRootPart
toolGripVM.Part1 = bodyAttach
end
end
end
function resetWelds()
local toolGrip = torso:FindFirstChild("ToolGrip")
local toolGripVM = viewmodel.HumanoidRootPart:FindFirstChild("ToolGrip")
local bodyAttach
if toolGripVM then
bodyAttach = toolGripVM.Part1
toolGripVM.Part1 = nil
end
if torso then
if toolGrip then
toolGrip.Part1 = bodyAttach
toolGrip.Part0 = torso
end
end
end
camera.ChildAdded:Connect(function(child)
if child.Name == "Viewmodel" and character then
viewmodel = child
setWelds()
end
end)
camera.ChildRemoved:Connect(function(child)
if child.Name == "Viewmodel" and character then
resetWelds()
end
end)
character.ChildAdded:Connect(function(child)
if child:IsA("Tool") then
if viewmodel and viewmodel.Parent == camera then
setWelds()
end
end
end)
character.ChildRemoved:Connect(function(child)
if child:IsA("Tool") then
if viewmodel and viewmodel.Parent == camera then
resetWelds()
end
end
end)