I made this, so far all it does is rotate randomly around the place. How can I make it so it will only rotate up and down?
local plane = game.Workspace.Union local player = game.Players.LocalPlayer repeat wait() until player.Character local character = player.Character local mouse = player:GetMouse() while true do wait() plane.CFrame = CFrame.new( plane.Position, Vector3.new(-90,-90,mouse.Hit.p.Z)); end
You want the plane to ignore the mouse's Z position, to do this you supply the Vector3 with the planes Z position.
plane.CFrame = CFrame.new(plane.Position, Vector3.new(mouse.Hit.X, mouse.Hit.Y, plane.Position.Z))
The full code is supplied below, I've also add mouse.TargetFilter so the plane wont try to point at itself.
local plane = workspace.Union local player = game.Players.LocalPlayer repeat wait() until player.Character local character = player.Character local mouse = player:GetMouse() mouse.TargetFilter = plane -- Optional so the plane wont try point at itself while wait() do plane.CFrame = CFrame.new(plane.Position, Vector3.new(mouse.Hit.X, mouse.Hit.Y, plane.Position.Z)) end
Althought TheDeadlyPanther's script will work it will result in the plane pointing either vertically upwards/downwards (Which I don't think you want?)
You're doing it wrong, so just do the following:
plane.CFrame = CFrame.new( plane.Position, Vector3.new(plane.CFrame.X,hit.p.Y,plane.CFrame.Z); -- if you want something to be the Y axis, keep it on the Y axis only
Hope I helped :)
~TDP