PivotTo is Pivot Tool Above Parts

It’s hard to explain, but I have an ID tool and whenever you stand on a certain part while holding it, it should go to a specific location but it goes above that instead

not supposed to happen:
image

supposed to happen:
image

The ID does not go into the building but on top of it and I don’t want that

script:

script.Parent.Touched:Connect(function(hit)
	if hit.Parent:FindFirstChild("Humanoid") and hit.Parent:FindFirstChild("ID") then
		local ID = hit.Parent.ID
		ID.Parent = workspace
		local descendants = ID:GetDescendants()
		for _, descendant in pairs(descendants) do
			if descendant:IsA("BasePart") then
				descendant.CanCollide = true
				descendant.Velocity = 0
			end
		end
		wait(.5)
		ID.Handle.CFrame = workspace.Pin.IDTP.CFrame
		ID:PivotTo(workspace.Pin.IDTP.Position)

		
	end
end)

Part in workspace (the TP location)


Called IDTP

i fixed it new script

script.Parent.Touched:Connect(function(hit)
	if hit.Parent:FindFirstChild("Humanoid") and hit.Parent:FindFirstChild("ID") then
		local ID = hit.Parent.ID
		ID.Parent = workspace
		local descendants = ID:GetDescendants()
		for _, descendant in pairs(descendants) do
			if descendant:IsA("BasePart") then
				descendant.CanCollide = true
				descendant.Velocity = Vector3.new(0,0,0)
			end
		end
		wait(.5)
		ID.Handle.CFrame = workspace.Pin.IDTP.CFrame
		ID:PivotTo(workspace.Pin.IDTP.Position)

		
	end
end)

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