Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Why does this error? ( Advanced Vectoring )

wait(5) -- Character load for studio 'Play Solo'
local Brick = game.Workspace.TestPart
local Player = game.Players['Player']

while wait() do
print(Player.Character.Torso['Position']) -- This works
Brick.Position=Vector3.new(Player.Character.Torso['Position']):lerp(Player.Character.Torso.CFrame*CFrame.new(0,2.5,-9)*CFrame.Angles(math.rad(-10),0,0),0.1)
end

--The print returns my Torso's Position but the Part doesnt CFrame to my torso. WHY?!?!?!

> My ERROR

18:27:47.970 - Workspace.Script:7: bad argument #1 to 'lerp' (Vector3 expected, got userdata)
18:27:47.971 - Script 'Workspace.Script', Line 7
18:27:47.973 - Stack End

1 answer

✓ Accepted answer

That's because the script is expecting a Vector3 value, rather than a CFrame value. Try this on line 07:

Brick.Position = Player.Character.Torso.Position:Lerp(Player.Character.Torso.Position + Vector3.new(0,2.5,-9), .1)
Brick.CFrame = Brick.Angles(math.rad(-10,0,0)

NOTE:

The reason why I didn't make a new Vector3 on the first code is because then the Brick's Position won't start from (0,0,0) when lerping.

2 comments

0

Thank you! I learned just that much more about Lerping! :D

0

You're welcome. :)

This discussion is preserved as it was. New answers, comments, and votes are closed.