Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How do i make an elevator? (still confused)

Im not asking you to make it for me. im asking you for help. i did the following code for example

example : car1 example 2 : vector 3 : 0,2,0

`s = script g = game.Workspace Car = s.Parent.Parent.Car1

function onClicked() Car.BodyVelocity.velocity = Vector3.new(0, -3, 0) end script.Parent.ClickDetector.MouseClick:connect(onClicked)

there's one thing i put for down. but the problem is. do i use weld for this. to prevent it from breaking apart? or. atleast give me a site to were i can find out how to do it effeciently. help me here! please. `

2 answers

✓ Accepted answer

Use bodyPosition to move it to a position, generally you have invisible markers at the floor, and you can put their position in a bodyPosition , which will cause it to move to the floor.

If using multiple parts, you should either use a weld script to weld it all together, or the weld surface type when building.

s = script
g = game.Workspace

Car = s.Parent.Parent

function onClicked()
	Car.BodyPosition.position = Car.Position + Vector3.new(0,3,0)
end

script.Parent.Parent.CD.MouseClick:connect(onClicked)

The above code will work, assuming you have the required BodyPosition.

It will move the Car up 3 from its original position.

Also, increase the maxforce of the BodyPosition, i used 40000

You will probably want a BodyGyro in there to keep Car stable, make sure to include the maxforce of Y in it.

You can from here add buttons to control the elevator up or down, or add floors. If you have for example an invisible marker at Floor one you can change

Car.BodyPosition.position = Car.Position + Vector3.new(0,3,0)

to

Car.BodyPosition.position = FloorOneMarker.Position

10 comments

0

Ok. so i can copy this exact thing but change vector3?

0

Yes, it should work exactly. Assuming you have everything in the correct place. You might want to modify the paths to the ClickDetector or the car depending on your setup.

0

Im currently on studio now. i dont understand how its not working. heres what i did. i welded everything to be in place. took the thing i wanted to be a button. added clickdetector and a script in it. put YOUR script in it. then i added body force and position to Car. and i upgraded the force. im still confused

0

also im getting a argument saying CD isnt part of model

0

WAIT!!!!!!!! do i put clickdetector and that script in the car????

0

Before trying to script, Please learn basic scripting and logic.

0

Read the script, and change it AS I TOLD YOU TO DO, so it will lead to where you put everything. Unless your click detector is named CD, CD will obviously not be found. I never said to use bodyforce, i said bodyGYRO.

0

"before trying to script, Please learn basic scripting and logic." uhh. thats sorta offensive. you should really look at the games i made :/

0

I am sorry, it was not my intention to be offensive.

0

forgiven

Why do you need a car if you are making an elevetor?

If you want to make an elevator I recommend using a for loop and CFrame.

2 comments

0

car1 represents the baseplate of the elevator.

0

So use CFrame inside a for loop.

This discussion is preserved as it was. New answers, comments, and votes are closed.