Glitch when I 'rerig' my character to play animation with Motor6D's

Hello everyone, When I try to ‘rerig’ a vent model and create the Motor6Ds, the player’s character snaps in this weird position:

Here is the script:

local ClickDetector = game.Workspace.Map.Vent.VentBase.ClickDetector
local VentBase = Instance.new("Motor6D")
local VentPart = Instance.new("Motor6D")
local Vent = game.ReplicatedStorage.Vent

ClickDetector.MouseClick:Connect(function(player)
	
	local chr = game.Players.LocalPlayer.Character or game.Players.LocalPlayer.CharacterAdded:Wait()
	
	local target = game.Workspace.Map.Vent.PrimaryPart
	
	function lookAt(chr,target) --assume chr is a character and target is a brick to look towards
		if chr.PrimaryPart then --just make sure the character's HRP has loaded
			local chrPos=chr.PrimaryPart.Position --get the position of the HRP
			local tPos=target.Position --get the position of the target
			local newCF=CFrame.new(chrPos,tPos) --create our CFrame
			chr:SetPrimaryPartCFrame(newCF) --set the HRP's CFrame to our result, thus moving the character!
		end
	end
	
	player.Character:moveTo(Vector3.new(-42, 3, -27.61 ),lookAt(chr, target))
	
	lookAt(chr, target)
	
	game:GetService("ContextActionService"):BindActionAtPriority(
		"t",
		function()
			return Enum.ContextActionResult.Sink
		end,
		false,
		Enum.ContextActionPriority.High.Value + 1,
		unpack(Enum.PlayerActions:GetEnumItems())
	)
	
	local newVent = Vent:Clone()
	newVent.Parent = player.Character

	VentBase.Name = "VentBase"
	VentBase.Part0 = chr.HumanoidRootPart
	VentBase.Part1 = chr.Vent.VentBase
	VentBase.Parent = chr.HumanoidRootPart
	
	VentPart.Name = "VentPart"
	VentPart.Part0 = chr.Vent.VentBase
	VentPart.Part1 = chr.Vent.VentPart
	VentPart.Parent = chr.Vent.VentBase
	
	
	
	--game.ReplicatedStorage.RemoteEvent:FireServer(player)
end)

game.ReplicatedStorage.RemoteEvent2.OnClientEvent:Connect(function(isnotMoving) 
	if isnotMoving == false then
		game:GetService("ContextActionService"):UnbindAction("t")
	end
end)
6 Likes

This is a local script. You don’t use local scripts to make manipulations to joints other than animating.

1 Like

alr, I will try changing it to a script? Would that fix the problem? I set up the Motor6D’s for after Loading in a vent animation.

It’s highly unlikely that just changing the script will work. You will have to adapt it to work on the server. I would rather advise you to find a different solution to your problem rather than changing rigs mid game.

1 Like

I mean is there any other way to animate a model than using Motor6D’s? I remember that ppl use Motor6D’s to animate their gun models in game.

Yes, Motor6D’s are used to animate things. But why would you need to change rigs mid game?

1 Like

its a Vent animation, if I parent the vent model with the player character to after animate it, would that not also like move the vent model with the character?

Just place the character on top of the vent and animate both separately. I don’t see the issue with doing that.

The Problem is, I already have a vent animation:


In the Workspace it looks like this:

What do you mean by placing the character on top of the vent? How would I animate them both separately?

Animate both of them separately and then play 2 animations at the same time

1 Like

But then I will have to rig the model with an HRP right? Let me try it out.

You dont have to rig the vent, there is a thing called AnimationController which allows to play animations without humanoids

1 Like

Really? Is it a plugin or already in Roblox Studio?

It’s a class that exists in studio.

1 Like

How would I use it I never heard about it?

The same way you animate a humanoid…

1 Like

I tried AnimationControllers but there is a weird glitch happening when I try to animate, maybe because of the offset or something?: