hi, i made a helicopter but i have a little issue with the movement
so, basicly when i take off, it starts to vibrate, its only visible on the server side, but it causes some calculation issues, like the speedometer (it randomly shows numbers between 1 and 60 knots)
i tried lowering the rotor speed, then i fixed the .05 stud gap between the rotor and body attachment points, but it did very little to it (the vibration is not visible anymore, but the speedometer is still crazy)
this is the main script
its a little weird because a never made a heli before
local body = script.Parent.Body
local rot = script.Parent.Main_Rotor.HingeConstraint
local rot2 = script.Parent.Tail_Rotor.HingeConstraint
local tork = script.Parent["torqe counter"].HingeConstraint
local steer = script.Parent["steering mechanism"].HingeConstraint
local tomeg = 0
local suly = 0
for _,v in pairs(script.Parent.Body:GetChildren()) do
if v:IsA("Seat") or v:IsA("BasePart") then
tomeg = tomeg + v.Mass
end
end
tomeg = tomeg + script.Parent.Main_Rotor.Mass + script.Parent.Tail_Rotor.Mass + script.Parent["torqe counter"].Mass + script.Parent["steering mechanism"].Mass
suly = tomeg * workspace.Gravity
suly = suly * 3.0955
local megy = false
local function leall()
megy = false
local plr = game.Players:FindFirstChild("RedstoneGyerek")
local gui = plr.PlayerGui["heli gui"]
local fram = gui.Frame
fram.engi.BackgroundColor3 = Color3.fromRGB(11, 106, 0)
gui.Enabled = false
body["engine sound"].jet.Playing = false
body["blade sound"].blade.Playing = false
rot.AngularVelocity = 0
rot2.AngularVelocity = 0
tork.AngularVelocity = 0
suly = tomeg * workspace.Gravity
end
body.driver.Changed:Connect(function()
if body.driver.Velocity.Magnitude > 5 then
body["engine sound"].jet.PlaybackSpeed = (body.driver.Velocity.Magnitude / 10000) * 0.025
body["blade sound"].blade.PlaybackSpeed = (body.driver.Velocity.Magnitude / 10000) * 0.025
else
body["engine sound"].jet.PlaybackSpeed = 1
body["blade sound"].blade.PlaybackSpeed = 1
end
if body.driver.Occupant then
if not megy then
megy = true
local hum = body.driver.Occupant
local char = hum.Parent
if char.Name == "RedstoneGyerek" then
local plr = game.Players:FindFirstChild("RedstoneGyerek")
local gui = plr.PlayerGui["heli gui"]
local fram = gui.Frame
local w_on = gui["heli control"].w_on
local a_on = gui["heli control"].a_on
local s_on = gui["heli control"].s_on
local d_on = gui["heli control"].d_on
local e_on = gui["heli control"].e_on
local q_on = gui["heli control"].q_on
local w_off = gui["heli control"].w_off
local a_off = gui["heli control"].a_off
local s_off = gui["heli control"].s_off
local d_off = gui["heli control"].d_off
local e_off = gui["heli control"].e_off
local q_off = gui["heli control"].q_off
local w = false
local a = false
local s = false
local d = false
local e = false
local q = false
gui.Enabled = true
body["engine sound"].start:Play()
rot.AngularVelocity = 500
rot2.AngularVelocity = 100
tork.AngularVelocity = -500
fram.engi.BackgroundColor3 = Color3.fromRGB(30, 255, 0)
wait(0.3)
fram.engi.BackgroundColor3 = Color3.fromRGB(11, 106, 0)
wait(0.3)
fram.engi.BackgroundColor3 = Color3.fromRGB(30, 255, 0)
wait(0.3)
fram.engi.BackgroundColor3 = Color3.fromRGB(11, 106, 0)
wait(0.3)
fram.engi.BackgroundColor3 = Color3.fromRGB(30, 255, 0)
wait(0.3)
fram.engi.BackgroundColor3 = Color3.fromRGB(11, 106, 0)
wait(0.3)
fram.engi.BackgroundColor3 = Color3.fromRGB(30, 255, 0)
wait(3.2)
body["engine sound"].jet.Playing = true
body["blade sound"].blade.Playing = true
w_on.OnServerEvent:Connect(function()
w = true
end)
w_off.OnServerEvent:Connect(function()
w = false
end)
a_on.OnServerEvent:Connect(function()
a = true
end)
a_off.OnServerEvent:Connect(function()
a = false
end)
s_on.OnServerEvent:Connect(function()
s = true
end)
s_off.OnServerEvent:Connect(function()
s = false
end)
d_on.OnServerEvent:Connect(function()
d = true
end)
d_off.OnServerEvent:Connect(function()
d = false
end)
e_on.OnServerEvent:Connect(function()
e = true
end)
e_off.OnServerEvent:Connect(function()
e = false
end)
q_on.OnServerEvent:Connect(function()
q = true
end)
q_off.OnServerEvent:Connect(function()
q = false
end)
local frc = Instance.new("BodyForce", body)
while megy do
wait(0.05)
if w and not s then
frc.Force = Vector3.new(body.Part.CFrame.LookVector.X,0,body.Part.CFrame.LookVector.Z) * 30000
end
if s and not w then
frc.Force = Vector3.new(body.Part.CFrame.LookVector.X,0,body.Part.CFrame.LookVector.Z) * -30000
end
if a and not d then
steer.AngularVelocity = 10000
end
if d and not a then
steer.AngularVelocity = -10000
end
if e and not q then
frc.Force = Vector3.new(frc.Force.X,suly + 50000,frc.Force.Z)
end
if q and not e then
frc.Force = Vector3.new(frc.Force.X,suly - 10000,frc.Force.Z)
end
if not w and not s then
frc.Force = Vector3.new(0,frc.Force.Y,0)
end
if not a and not d then
steer.AngularVelocity = 0
end
if not e and not q then
frc.Force = Vector3.new(frc.Force.X,suly,frc.Force.Z)
end
fram.spd.Text = "SPD: "..math.round(body.driver.Velocity.Magnitude * 0.2777160632).." kn"
fram.alt.Text = "ALT: "..math.round(body.driver.Position.Y * 0.4686914137).." f"
fram.cord.Text = "CRD: "..math.round(body.driver.Position.X)..", "..math.round(body.driver.Position.Z)
end
leall()
else
megy = false
end
end
else
if megy then
leall()
end
end
end)
And I assume the speedometer is just the default one given when sitting on VehicleSeats?
EDIT: Oh wait, I found the speedometer script in the code. Lemme have a look…
while megy do
wait(0.05)
local lastpos = body.driver.Position
if w and not s then
frc.Force = Vector3.new(body.Part.CFrame.LookVector.X,0,body.Part.CFrame.LookVector.Z) * 30000
end
if s and not w then
frc.Force = Vector3.new(body.Part.CFrame.LookVector.X,0,body.Part.CFrame.LookVector.Z) * -30000
end
if a and not d then
steer.AngularVelocity = 10000
end
if d and not a then
steer.AngularVelocity = -10000
end
if e and not q then
frc.Force = Vector3.new(frc.Force.X,suly + 50000,frc.Force.Z)
end
if q and not e then
frc.Force = Vector3.new(frc.Force.X,suly - 10000,frc.Force.Z)
end
if not w and not s then
frc.Force = Vector3.new(0,frc.Force.Y,0)
end
if not a and not d then
steer.AngularVelocity = 0
end
if not e and not q then
frc.Force = Vector3.new(frc.Force.X,suly,frc.Force.Z)
end
wait(0.05)
fram.spd.Text = "SPD: "..math.round((lastpos - body.driver.Position).Magnitude * 0.2777160632 * 20).." kn"
fram.alt.Text = "ALT: "..math.round(body.driver.Position.Y * 0.4686914137).." f"
fram.cord.Text = "CRD: "..math.round(body.driver.Position.X)..", "..math.round(body.driver.Position.Z)
end
ill test it with another player to see if the body vibrates or not
thanks for the help so far