Model:MoveTo() is Buggy

  1. What do you want to achieve?
    For the tool to move properly

  2. What is the issue?
    The model glitches out the tool, and a part just flickers between were it used to be and the buggy place

  3. What solutions have you tried so far?
    I’ve tried using a new model entirely but it didn’t fix anything

script.Parent.Unequipped:Connect(function()
	repeat 
		task.wait()
	until script.Parent.Parent.Name == "Backpack"
	
	
	local FlagTool = script.Parent.Flag.Parent
	local FlagModel = FlagTool.Flag
	
	local Player = FlagTool.Parent.Parent
	FlagModel.Parent = workspace
	FlagTool.Parent = game:GetService("ServerStorage").DroppedFlags
	
	FlagModel:MoveTo(Player.Character.HumanoidRootPart.Position + Vector3.new(0,0,3))
	
	for index, value in ipairs(FlagModel:GetDescendants()) do
		if value:IsA("BasePart") then
			value.CanCollide = false
			value.Anchored = false
		end
	end
	
	FlagModel.Detection.Touched:Wait()
	
	for index, value in ipairs(FlagModel:GetDescendants()) do
		if value:IsA("BasePart") then
			value.CanCollide = true
			value.Anchored = true
		end
	end
	
end)

Also yes, everything is welded and anchored / un anchored properly

robloxapp-20220531-1952545.wmv (1.9 MB)

2 Likes

Try using TweenService it should work a lot better, if its a model tho you will have to make use of PrimaryPart most likely

Use networkownership, use this:

for i, v in pairs(npc:GetChildren()) do
        if v:IsA("BasePart") or v:IsA("MeshPart") then
                   v:SetNetworkOwnerShip(nil)
        end
end

@AccessQ the tweening wont work due to it being a ‘moveto’ and that wont load animations or make anything better, plus calculating time can be hard for new learners

The thing is, Model:MoveTo(Pos) sets the position of the model, not the CFrame. This is a problem because position doesn’t render as fast as cframe.

Basically, to solve your problem, just do Model:PivotTo(CFrame.new(Pos)).

1 Like

It’s a model. Also, I don’t need to animate anything.

Not sure, It was working before but now it’s just not.

Have you tried changing the PrimaryPart’s CFrame directly?

Model.PrimaryPart.CFrame = newCFrame

I believe this post might be of further help.

I managed to fix the original bug happening, but now moveTo is just going to random places:
robloxapp-20220601-2002508.wmv (1.2 MB)

script.Parent.Unequipped:Connect(function()
	local ServerStorageService = game:GetService("ServerStorage")
	
	local FlagTool = script.Parent
	local FlagModel = FlagTool.Flag
	local Player = FlagTool.Parent.Parent
	
	repeat
		task.wait()
	until FlagTool.Parent.Name == "Backpack"
	
	FlagModel.Parent = workspace
	FlagTool.Parent = ServerStorageService.DroppedFlags
	
	for index, object in ipairs(FlagModel:GetDescendants()) do
		if object:IsA("BasePart") then
			object.Anchored = false
			object.CanCollide = false
		end
	end
	print(Player.Character.HumanoidRootPart.Position, Player.Character.Torso.Position)
	FlagModel:MoveTo(Player.Character.HumanoidRootPart.Position)
end)