--script.Parent:Destroy()

r=script.Parent
script:WaitForChild'To'
pos=script.Parent.CFrame
g,p=r:FindFirstChild'bg'or script.bg,r:FindFirstChild'bp'or script.bp
g.Parent,p.Parent=r,r
p.position=r.Position
function got(t)
if t:IsDescendantOf(workspace.Pick)then
	if t.Parent.Name=='Mod'then
	r.Parent=t.Parent
	script.To.Value=workspace.Finish
	else
	local m=Instance.new('Model',workspace.Pick)
	r.Parent,t.Parent=m,m
	m.Name='Mod'
	end
	local w=Instance.new('Weld',r)
	w.Part0=r
	w.Part1=t
	w.C0=CFrame.new(0,0,-r.Size.Z/2-.1)
	w.C1=CFrame.new(0,0,t.Size.Z/2)
elseif r.Parent.Name=='Mod'then
r.Parent:Destroy()script.Disabled=true
r:Destroy()script:Destroy()
return true
else
script.Disabled=true
r:Destroy()script:Destroy()
return true
end
end
wait(.1)
local rss=script.To.Value.Parent
while 1 do if script.To.Value and script.To.Value.Parent and script.To.Value.Parent==rss then
path=game:GetService'PathfindingService':ComputeRawPathAsync(pos.p,script.To.Value.Position,100)--wait(2)
s2=path:GetPointCoordinates()[2]or path:GetPointCoordinates()[1]
a,b=workspace:FindPartOnRay(Ray.new(pos.p,Vector3.new(0,-6)),r.Parent)
w=0
repeat w=w+1
if s2 then
local cf=CFrame.new(pos.p,s2)
pos=cf*CFrame.new(0,0,-.3)
a,b=workspace:FindPartOnRay(Ray.new(pos.p,Vector3.new(0,-6)),r.Parent)
p.position=Vector3.new(pos.X,b.Y+.3,pos.Z)
g.cframe=r.Velocity.magnitude>.5 and CFrame.new(r.Position,r.Position+r.Velocity)or g.cframe
if(Vector3.new(r.Position.X,0,r.Position.Z)-Vector3.new(pos.X,0,pos.Z)).magnitude>3 then
r.CFrame=r.CFrame-r.Position+Vector3.new(pos.X,b.Y+.3,pos.Z)
end
else break end
wait()until(r.Position-Vector3.new(s2.X,b.y,s2.Z)).magnitude<1 or(r.Position-Vector3.new(s2.X,b.y,s2.Z)).magnitude>6 or w>20
if script.To.Value and(r.Position-script.To.Value.Position).magnitude<8 then if got(script.To.Value)then break end end
else script.To.Value,rss=workspace.Finish,workspace wait()
end end
