Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Why won't any vector for the bodyforce thrust the right direction?

So I have a spaceship with thrusters and I want the spaceship to go forward (It's facing towards +Z), but it tilts all the wrong directions for some reason. The bodyforce is in the floor of the faceship and here is my script.

local isOn=false
function on()
	isOn=true
	script.Parent.BrickColor=BrickColor.new("Bright green")
	script.Parent.Parent.Floor.BodyThrust.Force=script.Parent.Parent.Floor.CFrame.LookVector*script.Parent.Speed.Value
	print(script.Parent.Parent.Floor.BodyThrust.Force)
end
function off()
	isOn=false
	script.Parent.BrickColor=BrickColor.new("Really red")
	script.Parent.Parent.Floor.BodyThrust.Force=Vector3.new(0,0,0)
end
function onClicked()
	if isOn==true then off() else on()end
end
script.Parent.ClickDetector.MouseClick:connect(onClicked)
off()

Here's a video of what happens.

https://gyazo.com/baa8c4ee89fb1d92dc7fe360d8a705ec

1 answer

Use a BodyGyro to prevent the rocket ship from turning in unwanted directions.

This discussion is preserved as it was. New answers, comments, and votes are closed.