MoveTo() Is moving to incorrect position

Hello, so, I have a ‘GunSpawn’ Part in all the crates, but, when I do MoveTo() sometimes it moves up or more down…
https://gyazo.com/e4ae628a50b5cfb78e09edc55b2d61cf
https://gyazo.com/4e35d8a38acd9555b990618c23ab9343
https://gyazo.com/03da463c60154ccfba3f3c500e417301

for i,v in ipairs(workspace.Map.Chunk1.Crates:GetChildren()) do			
	objects[v] = false																																																								
	v.Moving.ClickDetector.MouseClick:Connect(function(plr)
	if objects[v] == false then
		objects[v] = true --Primary
		v.Moving.ClickDetector.Open:Play()
		v.Moving.Primary.Motor.MaxVelocity = 0.03
		v.Moving.Primary.Motor.DesiredAngle = -1.05
		v.Moving.Particle.Sparkles.Enabled = false
		v.CurrentWeapon:ClearAllChildren()
		local Randomize = SetupCrates()
		local object = game.ReplicatedStorage.Weapons:FindFirstChild(Randomize)
		game.ReplicatedStorage.OOP.Notification:FireClient(plr, "You found "..Randomize)

		if object ~= "Nothing!" then
			wait(0.3)
			local Click
			local new = object:Clone()
			if object ~= "Nothing~" then
			local newc = Instance.new('ClickDetector', new)
			Click = newc 
			local Value = Instance.new('StringValue', v.CurrentWeapon)
			Value.Name = "Type"
			if game.ServerStorage:FindFirstChild(new.Name) then
			Value.Value = game.ServerStorage:FindFirstChild(new.Name).Class.Value
			end
			elseif object == "Nothing!" then
				Click = nil
		end
			
		new.Parent =v.CurrentWeapon
	     new:MoveTo(v.GunSpawn.Position)
	if Click ~= nil then
	 Click.MouseClick:Connect(function(Player)
		print('Ok!')
		local char = Characters[Player.UserId]
				if v.CurrentWeapon.Type.Value == "Primary" then
					char:SetPrimaryWeapon(new.Name)
				elseif  v.CurrentWeapon.Type.Value == "Secondary" then
					char:GiveSecondaryWeapon(new.Name)
				end
				new:Destroy()
				end)
					end
	     for b,a in ipairs(new:GetChildren()) do
		  if a:IsA("BasePart") then
			spawn(function()
				print('Ok')
				TweenService:Create(a, TweenInfo.new(2), {Position = a.Position + Vector3.new(0,1,0)}):Play()
				end)
			end
		end
		
		delay(20, function()
			v.CurrentWeapon:ClearAllChildren()
			end)
		
		delay(240, function()
			CleanUp(v)
			end)
		end
	end
	
end)
end
2 Likes

Vectors have collision detection - when an object is in the way of a desired position, the desired position will move up, so you’d have to use a Cframe, which doesn’t have any collision detection and use SetPrimaryPartCFrme

3 Likes

If I turn off collissions of the crate, will it work better?

1 Like

It won’t work at all, your only solution is using CFrames

2 Likes