How do i make a very simple landing gears script for planes

How do i make a very simple landing gear script for individual plane that player spawned (very new to scripting)

2 Likes

If you are new to scripting them I don’t recommend making something this complicated. I think it would be something with a motor 6d and some animations, or you can do cframe

1 Like

Im not thinking about animation and motor 6d what of i mean is very simple transparent 0 to 1 and CanCollide script

Ah in that case, you should already know how to do something like that. I suggest you have a book value called “IsLandingGearUp”. Then you can check the value when you want to see whether it’s up or not.

1 Like

You would loop through all the descendants of the model, check if they’re a BasePart and set their CanCollide/Transparency values:

for _, v in pairs(landingGearModel:GetDescendants()) do
    if v:IsA("BasePart") then
        v.CanCollide = false
        v.Transparency = 1
    end
end
1 Like

This is what i can do its client sided and cant be retracted back


local UserInputService = game:GetService("UserInputService")

UserInputService.InputBegan:Connect(function(Key) -- Input detected!
	if Key.KeyCode == Enum.KeyCode.G -- Checking if input is 'E'
	then
		for i,v in pairs(workspace.PlaneSystem.Plane.Parts.LandingGear:GetChildren()) do v.Transparency  = 1 
			v.CanCollide = false end

	end
end)


UserInputService.InputEnded:Connect(function(Key)
	if Key.KeyCode == Enum.KeyCodeG
	then
		for i,v in pairs(workspace.PlaneSystem.Plane.Parts.LandingGear:GetChildren()) do v.Transparency  = 0
			v.CanCollide = true end

	end
end)


Why are both checking to see if the user pressed “G”?

Was trying to make it “retractable” with one KeyCode

The thing is both will fire at the same timer, so the script will be retracting and extending the landing gear at the same time. This is why I suggested a bool value

Don’t think bool value works anymore on landing gears most of the planekit i seen use bool value in some way and almost of them dont work

Why would a bool value exclusively not work on a plane, it would work in any code…

Not in that way what i mean is the planekits gear scripts are old or non FE they dont even work in my testbed they use bool value as prime suggested