So the player has a tool, which is fully rigged and animated, and there is a clone of the weapon model that is part of the viewmodel. I’ve got a table of the tool’s joints as well as the viewmodel’s joints, and I am trying to make the viewmodel copy the tool’s motor6d transform values
Here’s the code
currentweaponjoints = {} -- the tool's joints
viewmodeljoints = {} -- the viewmodel's joints
RunService.PreSimulation:Connect(function()
if currentViewModel then
for i, weaponJoint in pairs(viewmodeljoints) do
local jointToCopy = weaponJoint[2]
local myJoint = weaponJoint[2]
for i, toolJoint in pairs(currentweaponjoints) do
if toolJoint[1] == weaponJoint[1] then
jointToCopy = toolJoint[2]
print(jointToCopy.Parent)
end
break
end
myJoint.Transform = jointToCopy.Transform
end
end
end)
Possibilites I’ve ruled out:
- The names of the joints not lining up, or joints having the same name
I run code from the server which renames every joint in every tool to have a unique name, and the viewmodel has all matching motor6d names. Furthermore, the print returns the correct parent, so I know this can’t be the issue - I made sure to run it on presimulation since I read that this is the way transformis meant to work.
What could be the problem? video: