Model moving after cloned?

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!

I would like to fix this somehow

  1. What is the issue? Include screenshots / videos if possible!

I have a script that will clone a rabbit model I made, in Replicated storage, and parent it to the player’s character and attach to their jaw via a rodconstraint, problem is, once cloned it will sort of “move” to the player and drag them toward it aswell until it attaches to the players mouth.

  1. What solutions have you tried so far? Did you look for solutions on the Developer Hub?

I looked for solutions yes, I made it so that immediately after being cloned its CFrame is set to the part that spawns it and added a wait() before it parents to the player. Didnt work, not surprised.
I suspect that its movement has to do with the origin position property, so when it leaves RepStorage it “spawns” in that position (you cant like, delete an origin position tho as far as im aware?).

After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!

Theres so far two “spawn parts” that give you the rabbit, the other one however, doesn’t experience the problem (as im guessing its closer to the origin position or smth?? Idk) so I haven’t shown it.
A video I recorded of the problem occuring, I didnt have a link so heres the file that I saved (hope thats ok):
robloxapp-20211115-1709541.wmv (1.3 MB)
There isnt any errors in the output.

Script (Nothing up until it clones causes a problem btw):

local CD = script.Parent.ClickDetector
local PE = script.Parent.ParticleEmitter
local grab = game.ReplicatedStorage.ItemGrab
local Rabbit = game.ReplicatedStorage.Rabbit

CD.MouseClick:Connect(function(player)
	local Char = player.Character
	local JawAttach = Char.Jaw.Attachment
	local HRP = Char.HumanoidRootPart
	local Anim = Char.Humanoid.Animator
	
	local Dig = Char.Dig
	local DigTrack = Anim:LoadAnimation(Dig)
	
	HRP.Anchored = true
	DigTrack:Play()
	PE.Enabled = true
	wait(2)
	DigTrack:Stop()
	HRP.Anchored = false
	PE.Enabled = false
	
	if not Char:FindFirstChild("Rabbit") then
		local num = math.random(1,10)
		
		if num == 1 then
			
			local NewRabbit = Rabbit:Clone()
			NewRabbit.HumanoidRootPart.CFrame = script.Parent.CFrame
			wait(.5)
			NewRabbit.Parent = Char
			NewRabbit.Name = "Rabbit"

			local Attach = Instance.new("Attachment")
			Attach.Parent = NewRabbit.Torso

			local Rod = Instance.new("RodConstraint")
			Rod.Parent = NewRabbit
			Rod.Attachment0 = Attach
			Rod.Attachment1 = JawAttach
			Rod.Length = 1

			grab:FireClient(player, "food")
		end
			
	  end
	end)

If there is something wrong with how I wrote my post please tell me and I will edit/delete accordingly!

Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.

1 Like

Try anchored the RootPart of the model.

Wont work, the rabbit is supposed to hang from the mouth, anchoring it will just bug it out as far as im concerned…

Anchor the HumanoidRootPart of the player’s character when cloning the rabbit and attaching it to the player’s character, then when it is attached set the HumanoidRootPart to unanchored again.

Will this stop the Rabbit from moving too?

Like this?

local CD = script.Parent.ClickDetector
local PE = script.Parent.ParticleEmitter
local grab = game.ReplicatedStorage.ItemGrab
local Rabbit = game.ReplicatedStorage.Rabbit

CD.MouseClick:Connect(function(player)
	local Char = player.Character
	local JawAttach = Char.Jaw.Attachment
	local HRP = Char.HumanoidRootPart
	local Anim = Char.Humanoid.Animator
	
	local Dig = Char.Dig
	local DigTrack = Anim:LoadAnimation(Dig)
	
	HRP.Anchored = true
	DigTrack:Play()
	PE.Enabled = true
	wait(2)
	DigTrack:Stop()
	HRP.Anchored = false
	PE.Enabled = false
	
	if not Char:FindFirstChild("Rabbit") then
		local num = math.random(1,10)
		
		if num == 1 then
			
			local NewRabbit = Rabbit:Clone()
			NewRabbit.Parent = Char
			NewRabbit.Name = "Rabbit"
			HRP.Anchored = true

			local Attach = Instance.new("Attachment")
			Attach.Parent = NewRabbit.Torso

			local Rod = Instance.new("RodConstraint")
			Rod.Parent = NewRabbit
			Rod.Attachment0 = Attach
			Rod.Attachment1 = JawAttach
			Rod.Length = 1
			HRP.Anchored = false

			grab:FireClient(player, "food")
		end
			
	  end
	end)

I tried it and it just zoomed the player toward the rabbit…

When you are creating or cloning parts or models, the last step should always be to Parent the instance, whereas this is way too soon. Your process should be:

  1. Clone the rabbit
  2. Position the Rabbiit
  3. Create Attachments
  4. Parent everything.

Really? Ive always cloned then parented and then create attachments and stuff first- Ill try this

It didn’t make a difference, was there supposed to be a difference?

Ok, try using a rope constraint then. Please tell me how it goes after.

1 Like

Ayyyyy it worked! Is there any reason a rope would work but not a rod?

1 Like

A RopeConstraint applies physics, so that way the rope can only extend a certain amount of length before stopping. You can always set how long the rope can extend in the properties.

2 Likes