Moveto or Pivotto not working

show me where that script is in the explorer

its in game.workspace in a part

did you restart the studio and see

script.Parent.DescendantAdded:Connect(function(child)
	task.wait(1)

        if child.Parent == script.Parent and child:IsA("Model") then
        child:MoveTo(script.Parent.Position)
        end
end)

Movement Logic:

  • Sometimes task.wait(1) might not be sufficient depending on how the game is running. Try increasing the wait time just to see if it’s a timing issue.
  • Make sure that script.Parent.Position is a valid Vector3 position.
    Alternative Approach:
  • If MoveTo and PivotTo are not working, you might try setting the CFrame directly
script.Parent.ChildAdded:Connect(function(child)
    -- Wait for the child to be properly added and loaded
    task.wait(2)  -- Increase the wait time for testing

    -- Ensure the primary part is set
    if child.PrimaryPart then
        -- Use CFrame to move the primary part
        local targetPosition = script.Parent.Position
        child:SetPrimaryPartCFrame(CFrame.new(targetPosition))
    else
        warn("No PrimaryPart found for child: ".. child.Name)
    end
end)
local function onChildAdded(child)
    if not child:IsA("PVInstance") then return end
	task.wait(1)
	child:PivotTo(script.Parent:GetPivot())
end

for _, child in script.Parent:GetChildren() do
    task.spawn(onChildAdded, child)
end
script.Parent.ChildAdded:Connect(onChildAdded)

26 replies, fruitless… wtf is this? ask chatgpt at this point lmfao, moveto is a humanoid method, pivotto is a model method that requires a primary part, or just set the cframe of the primary part directly, make sure the position/cframe is valid

I don’t think its got to do with anything how the part is being move, I think its to do with the event not being fired

if op didn’t debug that thats on him

Can’t really help if we don’t know much about it

No, MoveTo() also works on Models, not just Humanoids. You can do for example, Model:MoveTo(Vector3.new(0,0,0)) to change the position of a model without having to use CFrame.new(), or PivotTo(). In simple, it’s basically PivotTo() but it only needs a Vector3, and it only changes the position of a model. Not the overall CFrame.

i went to sleep last night, but i fixed it. tbh i kinda forgot how i did it, but i did it somehow.
I think it was sum like “Model:PivotTo(Script.Parent.Cframe)” or sum like that idk

I thought we found out that it was the child added event not firing?

sorry went to sleep again, i forgot to mention instead of doign it in a “ChildAdded” event im now putting it in the part of code where it actually parents the model to workspace. so (Parent, PivotTo) istead of (Parent, Wait for child added, PivotTo)

Actually, that’s probably a much better idea than having an event

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.