Hello everyone! :D It's me again with a question!
Today I tried to use lerp
, but it's not working out as I had hoped. ;/ I'm not sure what I'm supposed to be doing either.
What I'm trying to do is get a player to flip. Yup, that's it. lol But they're not flipping for some reason, and there's no errors being returned; I'm at a snag. :c
diz iz my code
local hrp = Workspace.TheeDeathCaster:FindFirstChild('HumanoidRootPart') if hrp then hrp.Anchored = true local EndCFrame = hrp.CFrame*CFrame.Angles(math.rad(360),0,0) local StartCFrame = hrp.CFrame for i = 1, 20 do hrp.CFrame = StartCFrame:lerp(EndCFrame, i/20) print('CFrame:', StartCFrame:lerp(EndCFrame, i/20)) -- Prints the cframe though. >.> wait(1/20) end hrp.Anchored = false end
Anyone know what I'm doing wrong? I also looked up questions on the website, but I don't quite understand them. :P (The answers, that is)
EDIT1
Rotation is being accounted for, but I had to set up the code differently; however, the player "teleports" when the lerp gets to a certain point.
Workspace.TheeDeathCaster.HumanoidRootPart.Anchored = true local StartCFrame = Workspace.TheeDeathCaster.HumanoidRootPart.CFrame for i = 360, 1, -5 do local EndCFrame = StartCFrame*CFrame.Angles(math.rad(i),0,0) Workspace.TheeDeathCaster.HumanoidRootPart.CFrame = StartCFrame:lerp(EndCFrame, i/360) print(StartCFrame:lerp(EndCFrame, i/360)) wait(1/13.37) end Workspace.TheeDeathCaster.HumanoidRootPart.Anchored = false
EDIT2: SOLVED I rearranged a lot of stuff, and I finally got it working, although it's not as 100% smooth as I had hoped it to be.