You can write your topic however you want, but you need to answer these questions:
- What do you want to achieve? Keep it simple and clear!
I would like to fix this somehow
- 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.
- 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.