Hey!
Recently I’ve made a few posts about an AI Helicopter problem. (see last post to understand lol)
Now I’ve kind of fixed it, I guess? Now all I need is the blades to spin tho…
Video:
As you see the blades don’t spin.
Any fix?
All scripts:
Right & Left Seat
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
script.Parent.Parent.Parent.bladeEvent:Fire()
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)
Rotor Script (tried but didn’t work, I will provide it:)
while true do
script.Parent.CFrame = script.Parent.CFrame * CFrame.fromEulerAnglesXYZ(0,1,0)
wait()
end
Helicopter Tweening 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 = 25
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()
print(NewPoint)
end
--Finalization
--wait(15)
game.Workspace.Helicopter.bladeEvent.Event:Connect(function()
print("Received signal")
wait(1)
WeldAIHelicopter()
AutoControlAIHelicopter()
end)
If there’s any fix, hope you can help.
Thanks <3