You can write your topic however you want, but you need to answer these questions:
- What do you want to achieve? Keep it simple and clear!
I want to create an Hoverboard(Sky Surfer) that the character can ride and fly with in the sky. the hoverboard must have the same X orientation as the CurrentCamera.
- What is the issue? Include screenshots / videos if possible!
The hoverboard’s X orientation is wrong
What is happening:
robloxapp-20240217-1906015.wmv (1.2 MB)
What I want:
robloxapp-20240217-1909270.wmv (1.9 MB)
- What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I watched a lot of videos on youtube and other social media platforms. I also asked multiple AIs with no solution.
Here is the code that should rotate the board to have the same X orientation as the camera:
if Flying.Value == true then
local camRotX, camRotY, camRotZ = Camera.CFrame:toEulerAnglesXYZ()
local AORotX,AORotY,AORotZ = AlignOrientation.CFrame:ToEulerAnglesXYZ()
local newCFrame = CFrame.fromEulerAnglesXYZ(AORotX,AORotY,camRotZ + math.rad(180))
AlignOrientation.CFrame = newCFrame
end
end)