For my FPS system, instead of using a viewport frame I am trying to attach the hands / arms to the actual tool and just CFraming that to make it seem animated (like this)
Gun.RightArm.CFrame = CFrame.new(v.Position, Gun.GunBody.Right.Position)
However, I am not sure if roblox allows weld constraints to be CFramed liked this, because it doesn’t work (no errors). All parts in the tool are welded to the handle (p0 is the part, p1 is the handle) and everything is unanchored.
The full scripts (for welding and cframing)
--Welding
for i,v in pairs(script.Parent.GunBody:GetChildren()) do
local c = Instance.new("WeldConstraint")
c.Parent = v
c.Part0 = v
c.Part1 = script.Parent.Handle
end
--arms
local c1 = Instance.new("WeldConstraint")
c1.Parent = script.Parent.RightArm
c1.Part0 = script.Parent.RightArm
c1.Part1 = script.Parent.Handle
local c2 = Instance.new("WeldConstraint")
c2.Parent = script.Parent.LeftArm
c2.Part0 = script.Parent.LeftArm
c2.Part1 = script.Parent.Handle
--CFraming (in another script)
Gun.Equpped:connect(function()
Gun.RightArm.CFrame = CFrame.new(Gun.RightArm.Position, Gun.GunBody.Left.Position)
Gun.LeftArm.CFrame = CFrame.new(Gun.LeftArm.Position, Gun.GunBody.Left.Position)
end)
Thankyou!