Opening Car Door

How do you make a car door to open?, I’ve tried using animations but I could not figure out how to rig it or use it for the animation editor, and I don’t know how to use motor6 or something to open it up, I also don’t want to use the classic invisible door trick, and Tweening won’t work as it is suppose to move.


The car door and properties in it

2 Likes

Use a HingeConstraint | Roblox Creator Documentation with the HingeConstraint | Roblox Creator Documentation set to Servo.
You can then set the HingeConstraint | Roblox Creator Documentation to whatever angle you want for the door to open and close.
You can have the script actuate with a ProximityPrompt or an OnClick setup.

3 Likes

Can you help me set it up? heres the setupimage
Those 2 parts at the bottom are suppose to be for the door hinge

local check = game:GetService("ProximityPromptService")
local Hinge = script.Parent.Part.HingeConstraint

local function open()
	if Hinge.TargetAngle == 0 then
	Hinge.TargetAngle = 75
	elseif Hinge.TargetAngle == 75 then
	Hinge.TargetAngle = 0
end
end

check.PromptTriggered:Connect(open)

heres the simple script

My problem is the hinge wont connect and im not sure if any of those extra contraints did something to stop it.

Edit: the hinge can connect now and moves, just gotta figure how the door wont go with it

2 Likes

Get rid of the extra Parts, and just move the Attachments into the LeftDoor and Chassis. You can move the Attachment in the Chassis to the e
It’s almost always easier to use less Parts.
Also don’t have the LeftDoor welded to the Chassis or anything else.
Have the LeftWindow welded to the LeftDoor since they’ll be moving together.
Here’s a simple door script that I made that should show you how everything should be attached:

I solved it yesterday, but now im trying to figure out why the hinge is broken or acting wierd after placing it back in the car.

Probably because you’ve got Parts that are supposed to be moving with the door script like the door and the window and you have them welded to Parts that aren’t supposed to be moving with the door script like the Chassis. If you get rid of the extra Parts you added it should make it easier to keep track of things like this.

I already did that, the door works fine if you place it outside of the car (during tests) and It glitched when its back in the frame.

this is what i mean btw
image
outside
image
inside

Is it the fact you are using Meshes that are probably hitting each other, there’s a plugin that shows the Mesh Decomposition Geometry that could help with that:
https://www.roblox.com/library/414923656/Mesh-Optimization-Tools

1 Like

I have a no collision constraints for all the meshes, Chassis and Door.

There is also a tool in the Studio Settings that shows a red sphere where Parts are colliding and can be helpful.

In a case like this I’d just use a few smaller Parts welded to the door Parts that have CanCollide turned on.

Are you sure your ‘no collision’ constraint is working?

I solved the non closing part, it closes now.

I only had to add more non collision constraints on the window

Btw is there by anychance you know how to seperate the Proximity prompts?, it runs both doors

What is the distance on your ProximityPrompts? It could be you are activating both at the same time.

I named them Part, and Part1 and put them on the script, still runs both whether which door is triggered

Yes, but I’m wondering if BOTH ProximityPrompts are being activated at the same time with the same input because they are so close.
Try decreasing the activation distance so if you’re sitting in the left seat you aren’t activating the right door’s ProximityPrompt.

you only need to trigger one to open both, so no?

You want to open both doors with the same Prompt? I thought you wanted them individually opened since the Prompt is in the LeftDoor, not the Chassis.
Then put the Prompt in the Chassis, and add both hinge parts to the script:
local lhinge = script.Parent.LHInge.HingeConstraint
local rhinge = script.Parent.RHInge.HingeConstraint

then add the lhinge and rhinge TargetAngles inside the function.

No what i meant is that if you trigger one of the prompt in the door, both doors open

That’s what I meant the first time. If you are too close to both doors when you click the Prompt, then both doors Prompts will be activated.
Make the activation distance smaller so you can only ‘reach’ the left door Prompt when sitting in the left seat, and the right door Prompt when sitting in the right seat.