SetPrimaryPartCFrame Help

Replace that with this:

I’ve already done that and @Aspecky my Trolly has a PrimaryPart I just couldn’t say yes because of the character limit.

1 Like

Make sure that your primary part is at the center of all the other parts.
Also try debugging your code.

Then the issue must be that your function isn’t even firing to begin with, slap a print() before the :SetPrimaryPartCFrame is called and see if the print prints something.

Huh, that’s strange, I put a print() before and after clone:SetPrimaryPartCFrame(tool.Parent.HumanoidRootPart.CFrame) and both of them printed but the model didn’t move.

Ok well that’s pretty strange, can you try:

clone:SetPrimaryPartCFrame(CFrame.new())

And see if it moves to the center of the world.

It doesn’t move to the center of the world.

Edit: I think the problem is the WeldConstraint.

It may very well be, weld constraints tend to keep stuff in place relative to what they are attached to.

@FlabbyBoiii grow up, bro. help this fellow human being.

Yes, it is because of that, I disabled it and then added clone.Primary.WeldConstraint.Enabled = true after clone:SetPrimaryPartCFrame(tool.Parent.HumanoidRootPart.CFrame) and it is now in front of the character but now it’s rotated.

It’s rotated because CFrame stores both positional and orientational data, you should do this instead if you wanna keep the trolly rotated to how it originally was.

clone:SetPrimaryPartCFrame(CFrame.new(tool.Parent.HumanoidRootPart.Position))

i really like what you are doing! but I’m not that good of an Scripter! I’m kinda, in like building or modeling, bc its easier for me! but keep it up.

That doesn’t work :confused::confused:

Did you re-enable your constraint? Because the function I sent you does work.

I’ve got

clone:SetPrimaryPartCFrame(CFrame.new(tool.Parent.HumanoidRootPart.Position))
clone.Primary.WeldConstraint.Enabled = true

Just remove the existence of that constraint and tell me if the function itself works, then we can tackle your constraint, cause I don’t know what you are using it for.

The constraint is to attach it to the character, if it isn’t there, it just falls through the ground.

So the trolly moves with the function I sent you after no constraint exists?

I’m confused, what do you mean?

Remove all constraints connected to the trolly, and execute this:

clone:SetPrimaryPartCFrame(CFrame.new(tool.Parent.HumanoidRootPart.Position))

Does it move to tool.Parent.HumanoidRootPart.Position or not?