To start off, I am still pretty new to scripting and I am editing a plane kit to have animated landing gears. The landing gear uses Motor6d. When you press G the DesiredAngle of the motor should be changed to what I have written, but the DesiredAngle doesn't change. There is no error in the output section and nothing in the plane kit itself is breaking. Can anyone help me figure out whats going on with the code setting the DesiredAngle?
Here was the code for the gear before I changed it:
Events.GearEvent.OnServerEvent:connect(function(client, val)
if val == "In" then
for _,g in pairs(Misc.LandingGear.Open:GetDescendants()) do
if g:IsA("BasePart") then
g.Transparency = 1
g.CanCollide = false
end
end
for _,g in pairs(Misc.LandingGear.Closed:GetDescendants()) do
if g:IsA("BasePart") then
g.Transparency = 0
g.CanCollide = true
end
end
elseif val == "Out" then
for _,g in pairs(Misc.LandingGear.Open:GetDescendants()) do
if g:IsA("BasePart") then
g.Transparency = 0
g.CanCollide = true
end
end
for _,g in pairs(Misc.LandingGear.Closed:GetDescendants()) do
if g:IsA("BasePart") then
g.Transparency = 1
g.CanCollide = false
end
end
end
end)
And here is the code after I edited it:
Events.GearEvent.OnServerEvent:connect(function(client, val)
if val == "In" then print("2")
for _,g in pairs(Misc.LandingGear.Open:GetDescendants()) do
if g.Name == "Motor" then
g.DesiredAngle = 0 do
end
for _,g in pairs(Misc.LandingGear.Closed:GetDescendants()) do
if g.Name == "Motor" then
g.DesiredAngle = -.5
end
end
end
else
if val == "Out" then print("9")
for _,g in pairs(Misc.LandingGear.Open:GetDescendants()) do
if g.Name == "Motor" then
g.DesiredAngle = 0
end
end
for _,g in pairs(Misc.LandingGear.Closed:GetDescendants()) do
if g.Name == "Motor" then
g.DesiredAngle = -.5 )
end
end
end
end
end)

1 comment
So converting the degrees to radians will fix the DesiredAngle being set? Or is there something going in with the code that’s causing it to not be set because when I click G the DesiredAngle isn’t set but if I manually type the DesiredAngle it works.