i tried to make a door which automatically opens, and so i made this script
local parent = game:GetService("Workspace").Model local mag = 3 local char = game:GetService("Players").LocalPlayer local otherpart = game:GetService("Workspace").Modeler local prevpos = game:GetService("Workspace").Modelerer if (parent.Position - char.Character.HumanoidRootPart.Position).magnitude < mag then for i = 1 , 2, 0.01 do parent.CFrame = parent.CFrame:Lerp(otherpart, i) end else for i = 1 , 2, 0.01 do parent.CFrame = parent.CFrame:Lerp(prevpos, i) end end
the thing is, it doesn't work help would be appreciated thx