Alrighty, hello.
I am working on an AI Helicopter Project, (inspired by Call of Duty)
Long story short, it’s bugging.
I reached out to the DevForum for requiring help.
Watch the video to understand the bug:
As you see I get a little bit teleported in the ground (And sometimes I get flinged out of the map bruh)
Anyways, the main issue is that once the helicopter gets tweened, the rotors stop spinning. I want it so they keep spinning.
All resources down below.
Top & Back Rotor Script:
while true do
script.Parent.CFrame = script.Parent.CFrame * CFrame.fromEulerAnglesXYZ(0,1,0)
wait()
end
Left & Right Seat Script:
seat = script.Parent
anim = seat.Animation
function Added(Descendant)
if (Descendant.ClassName == "Weld") then
local Humanoid = Descendant.Part1.Parent:FindFirstChild("Humanoid")
if Humanoid ~= nil then
Animation = Humanoid:LoadAnimation(anim)
Animation:Play()
end
end
end
function Removing(Descendant)
if Animation ~= nil then
Animation:Stop()
Animation:Remove()
end
end
seat.ChildAdded:Connect(Added)
seat.ChildRemoved:Connect(Removing)
Tweening Helicopter Script:
local TweenService = game:GetService("TweenService")
local RunService = game:GetService("RunService")
local Destinations = game.Workspace.Helicopter.DestinationPoints
local AIHelicopter = game.Workspace.Helicopter.HeliNoRotor
local NewPoint = 1
local Speed = 50
local debounce = false
AIHelicopter.PrimaryPart = AIHelicopter.Center
AIHelicopter:SetPrimaryPartCFrame(AIHelicopter.Center.CFrame)
function GetTime(Distance, Speed)
local Time = Distance / Speed
return Time
end
function WeldAIHelicopter()
for i = 1, #AIHelicopter:GetChildren() do
if AIHelicopter:GetChildren()[i] ~= AIHelicopter.PrimaryPart then
local Weld = Instance.new("WeldConstraint")
Weld.Part0 = AIHelicopter:GetChildren()[i]
Weld.Part1 = AIHelicopter.PrimaryPart
Weld.Parent = AIHelicopter.PrimaryPart
AIHelicopter:GetChildren()[i].Anchored = false
end
end
end
function AutoControlAIHelicopter()
NewPoint += 1
if not Destinations:FindFirstChild(""..NewPoint) then
wait(5)
NewPoint = 1
AIHelicopter.PrimaryPart.CFrame = Destinations:FindFirstChild("1").CFrame
wait(10)
end
local NextPoint = Destinations[""..NewPoint]
local Distance = (AIHelicopter.PrimaryPart.Position - NextPoint.Position).Magnitude
local Time = GetTime(Distance, Speed)
local TweenInformation = TweenInfo.new(Time,
Enum.EasingStyle.Linear,
Enum.EasingDirection.Out, 0, false, 0)
local Tween = TweenService:Create(AIHelicopter.PrimaryPart, TweenInformation, {CFrame = NextPoint.CFrame})
Tween:Play()
Tween.Completed:Wait()
AutoControlAIHelicopter()
end
--Finalization
wait(15)
WeldAIHelicopter()
AutoControlAIHelicopter()
How workspace looks like:
These are all the resources you need to assist me.
I find this very weird and I think it is 100% possible to fix.
Thank you so much for reading, and I hope someone helps me with this problem.
My friend @voozy_v tried to help, but also failed.
Thanks.