Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why is the lerp function not moving part2 too 0.75?

Asked by 1 year ago

local part = game.Workspace.P1 local part2 = game.Workspace.P2 function PartChange(player) task.wait(5) part2.CFrame = part.CFrame:Lerp(part.CFrame,0.75) end PartChange()

0
Format your code in a lua code block. WideSteal321 773 — 1y

1 answer

Log in to vote
0
Answered by 1 year ago
Edited 1 year ago

Next time, please add more explanation to your description other than the title. To format your code to a code block, click the Lua button up between the Title and Description boxes. Clicking it should appear two lines of 17 tildes (~), in separate lines, and a blank line in between. In that blank line is where you paste your code.

Solution

You're trying to lerp part.CFrame to itself, which will always return part.CFrame. I think you were trying to lerp part2.CFrame instead of part.CFrame.

local part = workspace.P1
local part2 = workspace.P2

function PartChange()
    task.wait(5)
    part2.CFrame = part2.CFrame:Lerp(part.CFrame, 0.75)
end

PartChange()
Ad

Answer this question