So I made this script that whenever the game runs it will make the part face another part using linear interpolation (CFrame:Lerp()), but whenever I put the 2nd part's CFrame.p inside the CFrame.angles() it says "Argument 3 missing or nil", here is the script I'm using:
Part1 = game.Workspace.Part
Part2 = game.Workspace.Part2
d = nil
while true do
wait()
print(Part2.CFrame.Position)
Part1.CFrame = Part1.CFrame:Lerp(Part1.CFrame * CFrame.Angles(game.Workspace.Part2.Position), 0.01) --The error is here.
print(Part1.CFrame.p)
end
The output reads:
33.4099998, 11.6699696, -83.8799973
14:27:19.557 - Argument 3 missing or nil
14:27:19.557 - Stack Begin
14:27:19.558 - Script 'ServerScriptService.Script', Line 10
14:27:19.558 - Stack End
Is it a newbie mistake, because i put a wrong value or something else? thank you!
EDIT: What I did to fix this was do Part1.CFrame = Part1.CFrame:Lerp(CFrame.new(Part1.CFrame.p, Part2.CFrame.p), 0.01)
instead of Part1.CFrame = Part1.CFrame:Lerp(Part1.CFrame * CFrame.Angles(game.Workspace.Part2.Position), 0.01)

1 comment
Do game.Workspace.Part2.Orientation instead of game.Workspace.Part2.Position.