Are you looking to make the spaceship controls relative to how the camera is facing like how the normal humanoid Robloxian character walks along the floor?
If so we can steal some code from @ThanksRoBama to get movement vectors that are relative to the camera.
--in a local script to detect player input
local InputS = game:GetService("UserInputService")
local player = game.Players.LocalPlayer
local camera = game.Workspace.CurrentCamera
local walkKeyBinds = {
Forward = { Key = Enum.KeyCode.W, Direction = Enum.NormalId.Front },
Backward = { Key = Enum.KeyCode.S, Direction = Enum.NormalId.Back },
Left = { Key = Enum.KeyCode.A, Direction = Enum.NormalId.Left },
Right = { Key = Enum.KeyCode.D, Direction = Enum.NormalId.Right }
}
local function getWalkDirectionCameraSpace()
local walkDir = Vector3.new()
for keyBindName, keyBind in pairs(walkKeyBinds) do
if InputS:IsKeyDown(keyBind.Key) then
walkDir += Vector3.FromNormalId( keyBind.Direction )
end
end
if walkDir.Magnitude > 0 then --(0, 0, 0).Unit = NaN, do not want
walkDir = walkDir.Unit --Normalize, because we (probably) changed an Axis so it's no longer a unit vector
end
return walkDir
end
local function getWalkDirectionWorldSpace()
local walkDir = camera.CFrame:VectorToWorldSpace( getWalkDirectionCameraSpace() )
walkDir *= Vector3.new(1, 0, 1) --Set Y axis to 0
if walkDir.Magnitude > 0 then --(0, 0, 0).Unit = NaN, do not want
walkDir = walkDir.Unit --Normalize, because we (probably) changed an Axis so it's no longer a unit vector
end
return walkDir
end
Then after the above-copied piece of code sets up the functions for obtaining the movement on the XZ plane relative to the camera.
Then we can set the body velocity to the walkDir obtained through the following functions.
bv.Velocity = getWalkDirectionWorldSpace() * speed
Edit: Otherwise I would use multiplication in order to make the movement relative to the part CFrame.
local rightVec = part.CFrame.RightVector * xDirect * speed
local upVec = part.CFrame.UpVector * yDirect * speed
local lookVec = part.CFrame.LookVector * zDirect * speed
local netMovementDirection = lookVec+upVec+rightVec
bv.Velocity = netMovementDirection * Vector3.new(1,0,1)