In this video here, you can see how the pencil spawns at a certain angle and then is supposed to lerp itself right side up. However, there is a slight angle to it, and I thought I could offset this by lerping the cframe.angles to 0,0,0, however I cant. I’ve looked on the dev forum and people keep saying to use *Cframe.angles but that only adds on to the current angle. Keep in mind this is all done with a lerp:
local function moveTo()
playerCords.x = rootP.Position.X + math.random(-10,10)
playerCords.z = rootP.Position.Z + math.random(-10,10)
local t = tick()
local event
event = runService.Heartbeat:Connect(function(dt)
if tick() - t >= 2 then
event:disconnect()
else
local function calculateNumber(cT)
local t = cT / 2
if t <= 1 then
return 50 * math.exp(-2 * (t - 0.5))
else
return 50 * math.log(2 * t + 1)
end
end
local d = (2*dt)/2
local y = calculateNumber(tick()-t)
attachment.CFrame = attachment.CFrame:Lerp(CFrame.new(playerCords.x,y,playerCords.z),d)
end
end)
end