I’ve made a flying broomstick fly, but the rotating is wonky at the moment. This is the script:
local CheapSweep4 = script.Parent
local player = game.Players.LocalPlayer
local seat = game.Workspace:WaitForChild(player.Name.."'s CheapSweep4").Seat
local BodyVelocity = game.Workspace:WaitForChild(player.Name.."'s CheapSweep4").Seat.BodyVelocity
local stick = game.Workspace:WaitForChild(player.Name.."'s CheapSweep4").Stick
local Back = game.Workspace:WaitForChild(player.Name.."'s CheapSweep4").Back
local ring = game.Workspace:WaitForChild(player.Name.."'s CheapSweep4").Ring
local gyro = game.Workspace:WaitForChild(player.Name.."'s CheapSweep4").Stick.BodyGyro
local Camera = workspace.CurrentCamera
local RunService = game:GetService("RunService")
local Stepped
seat.Changed:Connect(function(property)
if property ~= "Occupant" then return end
local occupant = seat.Occupant
if occupant then
Stepped = game:GetService("RunService").RenderStepped:Connect(function()
local cam = workspace.CurrentCamera
local midpt = cam.ViewportSize/2
local direction = Camera.CFrame.LookVector
gyro.CFrame = CFrame.lookAt(Vector3.new(), direction)
end)
else
Stepped:Disconnect()
end
end)
NOTE: Some of the variables are not in use at the moment.
Whenever I turn the camera to the right or left or up or down, the broomstick keeps rotating in that direction, instead of just looking at whatever direction that the Camera is facing. Does anyone have an idea as to why? The BodyGyro values: D - 500, P - 3000, MaxTorque - 400000,400000,400000