How can you make an offset to a motor6d

Change the C0 to a lower CFrame.
Like this: CFrame.new(0,10,0) to CFrame.new(0,2,0) or CFrame.new(0,-10,0)

When I move my camera the thing moves

You can give me the complete script? I will try to fix it.

This is not the full script but just the function thats important. The full script handles everything client model function (Aiming, Effects, Recoil, Stuff that is not important.)

local function equip(name, tool)
	local Models = RGE.GunModels:WaitForChild(name,5)

	if Models and not EquipDebounce and not Equipped then
		EquipDebounce=true
		local Model = Models.Client:Clone()
		ContentProvider:PreloadAsync({Model})
		local Conf = require(tool.Config)
		local Handle = Model:WaitForChild("Handle")
		local RightGrip = RightArm:WaitForChild("RightGrip")
		RightGrip.Part0 = RightArm
		RightGrip.Part1 = Handle
		RightGrip.C0 = RightArm.CFrame:Inverse()
		RightGrip.C1 = Handle.CFrame:Inverse()
		Model.Parent = Dummy

		local VPModel = Model:Clone()
		VPModel.Parent=HUD.Frame.ViewportFrame
		VPModel:SetPrimaryPartCFrame(CFrame.new(0,0,-2)*CFrame.Angles(rad(-90),rad(-90),rad(-90)))

		ToolInfo={Tool=tool, Config=Conf, VPModel=VPModel}
		Equipped=name
		----------------------

		Animations.Idle=FPSHumanoid:LoadAnimation(Conf.ClientAnimations.Idle)
		Animations.Fire=FPSHumanoid:LoadAnimation(Conf.ClientAnimations.Fire)
		Animations.Reload=FPSHumanoid:LoadAnimation(Conf.ClientAnimations.Reload)

		if Conf.ClientAnimations.Equip then
			Animations.Equip=FPSHumanoid:LoadAnimation(Conf.ClientAnimations.Equip)
		end

		stopAllAnimations()
		Animations.Idle:Play()
		EquipDebounce=false
	end
end

Unequip function:

Character.ChildRemoved:Connect(function(child)
	EquipDebounce=true
	if child:IsA("Tool") and child.Name==Equipped then
		Equipped=nil
		Dummy.Client:Destroy()
		ToolInfo.VPModel:Destroy()
		stopAllAnimations()
	end
	EquipDebounce=false
end)

Try that and send me the results.

local function equip(name, tool)
local Models = RGE.GunModels:WaitForChild(name,5)

if Models and not EquipDebounce and not Equipped then
	EquipDebounce=true
	local Model = Models.Client:Clone()
	ContentProvider:PreloadAsync({Model})
	local Conf = require(tool.Config)
	local Handle = Model:WaitForChild("Handle")
	local weld = Instance.new("ManualWeld", Handle)
	local offset = CFrame.new(0,0,0) * CFrame.Angles(0,0,0)
	weld.Part0 = Handle
	weld.Part1 = RightArm
	weld.C0 = offset
	Model.Parent = Dummy

	local VPModel = Model:Clone()
	VPModel.Parent=HUD.Frame.ViewportFrame
	VPModel:SetPrimaryPartCFrame(CFrame.new(0,0,-2)*CFrame.Angles(rad(-90),rad(-90),rad(-90)))

	ToolInfo={Tool=tool, Config=Conf, VPModel=VPModel}
	Equipped=name
	----------------------

	Animations.Idle=FPSHumanoid:LoadAnimation(Conf.ClientAnimations.Idle)
	Animations.Fire=FPSHumanoid:LoadAnimation(Conf.ClientAnimations.Fire)
	Animations.Reload=FPSHumanoid:LoadAnimation(Conf.ClientAnimations.Reload)

	if Conf.ClientAnimations.Equip then
		Animations.Equip=FPSHumanoid:LoadAnimation(Conf.ClientAnimations.Equip)
	end

	stopAllAnimations()
	Animations.Idle:Play()
	EquipDebounce=false
end

end

1 Like

Now there aren’t any animations.

It didn’t give you an error? I will improve the animations.

local Animations = {}
local plr = game.Players:GetPlayerFromCharacter(FPSHumanoid.Parent)

plr.CharacterAdded:Connect(function(char)
FPSHumanoid = char:WaitForChild(“Humanoid”)
Animations = {
Idle=FPSHumanoid:LoadAnimation(Conf.ClientAnimations.Idle),
Fire=FPSHumanoid:LoadAnimation(Conf.ClientAnimations.Fire),
Reload=FPSHumanoid:LoadAnimation(Conf.ClientAnimations.Reload)
}
end)

local stopAllAnimations = function()
for v, anime in pairs(Animations) do
anime:Stop()
end
end

local function equip(name, tool)
local Models = RGE.GunModels:WaitForChild(name,5)
if Models and not EquipDebounce and not Equipped then
EquipDebounce=true
local Model = Models.Client:Clone()
ContentProvider:PreloadAsync({Model})
local Conf = require(tool.Config)
local Handle = Model:WaitForChild(“Handle”)
local weld = Instance.new(“ManualWeld”, Handle)
local offset = CFrame.new(0,0,0) * CFrame.Angles(0,0,0)
weld.Part0 = Handle
weld.Part1 = RightArm
weld.C0 = offset
Model.Parent = Dummy

	local VPModel = Model:Clone()
	VPModel.Parent=HUD.Frame.ViewportFrame
	 		VPModel:SetPrimaryPartCFrame(CFrame.new(0,0,-2)*CFrame.Angles(math.rad(-90),math.rad(-90),math.rad(-90)))

	ToolInfo={Tool=tool, Config=Conf, VPModel=VPModel}
	Equipped=name

	if Conf.ClientAnimations.Equip then
		Animations.Equip=FPSHumanoid:LoadAnimation(Conf.ClientAnimations.Equip)
	end

	Animations.Idle:Play()
	EquipDebounce=false
end

end

Oh no I forgot, it not a manualWeld is a motor6d. Sorry

local function equip(name, tool)
local Models = RGE.GunModels:WaitForChild(name,5)

if Models and not EquipDebounce and not Equipped then
	EquipDebounce=true
	local Model = Models.Client:Clone()
	ContentProvider:PreloadAsync({Model})
	local Conf = require(tool.Config)
	local Handle = Model:WaitForChild("Handle")
	local weld = Instance.new("Motor6D", Handle)
	local offset = CFrame.new(0,0,0) * CFrame.Angles(0,0,0)
	weld.Part0 = Handle
	weld.Part1 = RightArm
	weld.C0 = offset
	Model.Parent = Dummy

	local VPModel = Model:Clone()
	VPModel.Parent=HUD.Frame.ViewportFrame
	VPModel:SetPrimaryPartCFrame(CFrame.new(0,0,-2)*CFrame.Angles(rad(-90),rad(-90),rad(-90)))

	ToolInfo={Tool=tool, Config=Conf, VPModel=VPModel}
	Equipped=name
	----------------------

	Animations.Idle=FPSHumanoid:LoadAnimation(Conf.ClientAnimations.Idle)
	Animations.Fire=FPSHumanoid:LoadAnimation(Conf.ClientAnimations.Fire)
	Animations.Reload=FPSHumanoid:LoadAnimation(Conf.ClientAnimations.Reload)

	if Conf.ClientAnimations.Equip then
		Animations.Equip=FPSHumanoid:LoadAnimation(Conf.ClientAnimations.Equip)
	end

	stopAllAnimations()
	Animations.Idle:Play()
	EquipDebounce=false
end

end

If this is for a model and not just 1 handle, why not weld all parts of the gun to the main handle, and animate the handle as necessary? That way you can just setup a motor6d to the right arm, and it will follow wherever the right arm is facing. Unless I’m missing something here.