I want to make my character teleport 45* degrees of where the character is looking, assuming I'm in first person. I've tried to use rightvector and lookvector but I don't know how to get the 45-degree angle.
So I assume you're confused how to get the proper direction. No cframe has a stock 45 degrees vector. You can easily get there with the lookvector of [that cframe offset by a 45deg cframe].
CFrame.Angles() returns a cframe with no position but rotated with the given radian angles. The radian angle you want is math.pi/-4. Y value spins vertically. CFrame.Angles(0,math.pi/-4,0)
Offset the original's rotation by 'multiplying' this. Then you have a useful direction: (cf*CFrame.Angles(0,math.pi/-4,0)).lookVector
Then of course multiply it by a distance, add to the original. hope you get it!
local char = game.Players.LocalPlayer.Character local ppartcf = char.PrimaryPart.CFrame local new = ppartcf+(ppartcf*CFrame.Angles(0,math.pi/-4,0)).lookVector*5 char:SetPrimaryPartCFrame(new)
local plr = game.Players.LocalPlayer repeat wait() until plr.Character local char = plr.Character char:SetPrimaryPartCFrame(char.PrimaryPart.CFrame * CFrame.Angles(math.rad(45),0,0))