Got this off roblox-wiki yet funnily enough, the part goes in a completely opposite direction to where I want it to go. Please can someone help me to fix? Does not show any errors or anything like that! The script is used after another identicular script but with a different position.
The code: (The code is in a script in a part, I also added some stuff to it for when it is completed it's movements.)
local Part = script.Parent local newPos = Vector3.new(30.976, 6.022, 8.345) local Time = 1 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 script.Parent.Orientation = Vector3.new(0, -22.18, 0) Part.Position = Vector3.new(30.976, 6.022, 8.345) Debounce = false end game.Workspace.AnimationValues.Jump.Changed:Connect(function() MovePart() end)