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

Argument 3 missing or nil whever i try to lerp angles?

Asked by 4 years ago
Edited 4 years ago

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)

0
Do game.Workspace.Part2.Orientation instead of game.Workspace.Part2.Position. Dovydas1118 1495 — 4y

2 answers

Log in to vote
1
Answered by 4 years ago

CFrame.Angles() needs three parameters you only gave it one

see CFrame API wiki

I think the other person that awnsered is right with what u ment to do, but he didnt explain it

Ad
Log in to vote
-1
Answered by 4 years ago

i dont know

Part1 = game.Workspace.Part
Part2 = game.Workspace.Part2
d = nil

while true do
    wait()
    print(Part2.CFrame.Position)
       Part1.CFrame = Part1.CFrame:Lerp(game.Workspace.Part2.CFrame, 0.01) --The error is here.
    print(Part1.CFrame.p)
end

Answer this question