Okay. The one on I use,

local Part = Workspace.Part
local newPos = Part.Position + Vector3.new(0,5,0)
local Time = 10
local Increment = 0.5
local Debounce = false
 
local Diff = newPos - Part.Position
local Mag = Diff.magnitude 
local Direction = CFrame.new(Part.Position, newPos).lookVector
 
function MovePart()
	if Debounce then return end
	Debounce = true
	for n = 0, Mag, Increment do
		Part.CFrame = Part.CFrame + (Direction * Increment)
		wait( (Time/Mag) * Increment )
	end
	Debounce = false 
end
 
Workspace.Button.ClickDetector.MouseClick:connect(MovePart)

Doesn't work for me. Can someone help me?

1 comment

2

I'm guessing you just copy-pasted this code and hoped it would work. You gotta actually understand it. For example, unless you have the exact Workspace.Button.ClickDetector and Workspace.Part hierarchy, it won't work at all.