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

Spaccraft Controls [NEED HELP] How do you rotate the ship relative to the part rotated?

I am confused about how I would go about rotating a part in local space. I want it to rotate local to its current rotation. If I can do so with body movers and without using a loop then I would love that. I am currently using UserInput to fire the rotation inside of a function as seen below.

local Config = require(script.Parent.ShipSeat.Configuration)

game.ReplicatedStorage.KeyDownEvent.OnServerEvent:connect(function(player,key)
	if player.Name == script.Parent.ShipSeat.ShipOwner.Value then
		if key == Config.keyconfig.Forward then
			
		elseif key == Config.keyconfig.Incline then
			
		elseif key == Config.keyconfig.RotLeft then
			
		end
	end
end)

game.ReplicatedStorage.KeyUpEvent.OnServerEvent:connect(function(player,key)
	if player.Name == script.Parent.ShipSeat.ShipOwner.Value then
		if key == Config.keyconfig.Forward then
			
		elseif key == Config.keyconfig.Incline then
			
		elseif key == Config.keyconfig.RotLeft then
			
		elseif key == Config.keyconfig.RotRight then
			
		end
	end
end)

whoever answers my question..Thanks in advance. :D

1 answer

model.PrimaryPart = ThePartRotatingAround
model.SetPrimaryPartCFrame(CFrame.Angles(0,Math.rad(1),0) * model.PrimaryPart.CFrame)

1 comment

0

Explain your answer in English. Don't just post code; this doesn't help the poster or the community understand why the code does what it does.

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