Making doors for an elevator

Hey Developers,

I need help making elevator doors! I would like it to look like this:

And this is my code:

local SIDE_DOOR = script.Parent.Parent.Doors.SIDE_DOOR
local TOP_DOOR = script.Parent.Parent.Doors.TOP_DOOR

function topDoor()
	for count = 16, 0, -1 do
		TOP_DOOR.Position = +0.5 -- the '+' is underlined in red
		wait(1)
	end
end

function sideDoor()
	-- help me here aswell
end

function startElevator()
	topDoor()
	wait(0.5)
	sideDoor()
end

script.Parent.ClickDetector.MouseClick:Connect(startElevator)

But instead it just does stays in the same position. This line of text is from the output bar: Workspace.Underground Space.Elevator.START.Script:6: attempt to perform arithmetic (add) on table and number

Please help and thank you if you did!

Hey, you can try use tweening for your door, make 2 transparency copies of the door. One closed and one opened. with this you can tween it.

local TweenService = game:GetService("TweenService")
local Tween = TweenInfo.new(0.5, Enum.EasingStyle.Quad, Enum.EasingDirection.Out, 0, false, 0)
local CPOS = {CFrame = ClosedWaypoint.CFrame}
local OPOS = {CFrame = OpenedWaypoint.CFrame}
local CTween = TweenService:Create(door.door, Tween, CPOS)
local OTween = TweenService:Create(door.door, Tween, OPOS)
2 Likes

Can you give me an example script?

I tried that but it does not give me the right education.

local ProximityPromptService = game:GetService("ProximityPromptService")
local door = game.Workspace:WaitForChild("tehdoor")
local menu = script.Parent.Parent
local tween = game:GetService("TweenService")
local pp = door.proximity.ProximityPrompt
--//Objects
local ClosedWaypoint = door.DoorClosed
local OpenedWaypoint = door.DoorOpened
local csound = door.Close
local osound = door.Open
--//Tweening
local TweenService = game:GetService("TweenService")
local Tween = TweenInfo.new(0.5, Enum.EasingStyle.Quad, Enum.EasingDirection.Out, 0, false, 0)
local CPOS = {CFrame = ClosedWaypoint.CFrame}
local OPOS = {CFrame = OpenedWaypoint.CFrame}
local CTween = TweenService:Create(door.door, Tween, CPOS)
local OTween = TweenService:Create(door.door, Tween, OPOS)
on = true
-- Detect when prompt is triggered
local function onPromptTriggered(promptObject, player)
	if on == true then
		OTween:Play()
		pp.ActionText = "Close"
		on = false
	else
		CTween:Play()
		pp.ActionText = "Open"
		on = true
	end
end
ProximityPromptService.PromptTriggered:Connect(onPromptTriggered)

Yes, you can use this script.
Prompts are also better because they look clean for me

Just testing it, it’s a bit complicated for me lol

It doesn’t work, do you want me to give a video?

Also what I’m aiming to do is for it to close (proximity prompt or click detector) and teleport the player to another location, then re-open (automatically)

Have you added the proximity prompts in the object or model? I dont think i can give a video sorry

the re-open is easy, but teleporting. You need to make a part inside the elevator thats the same size of the elevator and teleport the player to another location when they touch it

At line 6; its supposed to be:

TOP_DOOR.Position += Vector3.new(0, 0.5, 0) 

It’s too ‘big’ apparently, when 10MB is the max size and it is 3MB-

Send some pics or make the video even more shorter

1 Like

I’m kind of editing the script to make it like the video says:

local ProximityPromptService = game:GetService("ProximityPromptService")
local TOP_DOOR = script.Parent.Parent.Doors.TOP_DOOR
local SIDE_DOOR = script.Parent.Parent.Doors.SIDE_DOOR
local menu = script.Parent.Parent
local tween = game:GetService("TweenService")
local pp = script.Parent.ProximityPrompt
--//Objects
local ClosedWaypoint = door.DoorClosed
local OpenedWaypoint = door.DoorOpened
local csound = door.Close
local osound = door.Open
--//Tweening
local TweenService = game:GetService("TweenService")
local Tween = TweenInfo.new(0.5, Enum.EasingStyle.Quad, Enum.EasingDirection.Out, 0, false, 0)
local CPOS = {CFrame = ClosedWaypoint.CFrame}
local OPOS = {CFrame = OpenedWaypoint.CFrame}
local CTween = TweenService:Create(door.door, Tween, CPOS)
local OTween = TweenService:Create(door.door, Tween, OPOS)
on = true
-- Detect when prompt is triggered
local function onPromptTriggered(promptObject, player)
	if on == true then
		OTween:Play()
		pp.ActionText = "Close"
		on = false
	else
		CTween:Play()
		pp.ActionText = "Open"
		on = true
	end
end
ProximityPromptService.PromptTriggered:Connect(onPromptTriggered)

I want a top door to come down, a side door to move along and then it will tp a player somewhere else, then it will do the same as above and open it up.

Hello?

charrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr

Did you make 6 doors, 2 doors, 2 transparent closed doors and 2 transparent open doors

I made 2 doors, this is my explorer:

explorer

I want a top door to come down, a side door to move along and then it will tp a player somewhere else, then it will do the same as above and open it up.

Can you update the script?

local ProximityPromptService = game:GetService("ProximityPromptService")
local TOP_DOOR = script.Parent.Parent.Doors.TOP_DOOR
local SIDE_DOOR = script.Parent.Parent.Doors.SIDE_DOOR
local menu = script.Parent.Parent
local tween = game:GetService("TweenService")
local pp = script.Parent.ProximityPrompt
--//Objects
local ClosedWaypoint = door.DoorClosed
local OpenedWaypoint = door.DoorOpened
local csound = door.Close
local osound = door.Open
--//Tweening
local TweenService = game:GetService("TweenService")
local Tween = TweenInfo.new(0.5, Enum.EasingStyle.Quad, Enum.EasingDirection.Out, 0, false, 0)
local CPOS = {CFrame = ClosedWaypoint.CFrame}
local OPOS = {CFrame = OpenedWaypoint.CFrame}
local CTween = TweenService:Create(door.door, Tween, CPOS)
local OTween = TweenService:Create(door.door, Tween, OPOS)
on = true
-- Detect when prompt is triggered
local function onPromptTriggered(promptObject, player)
	if on == true then
		OTween:Play()
		pp.ActionText = "Close"
		on = false
	else
		CTween:Play()
		pp.ActionText = "Open"
		on = true
	end
end
ProximityPromptService.PromptTriggered:Connect(onPromptTriggered)

make 4 extra doors, copy paste those 2 doors 2 times, make side and top door clone open and make side and top door clone2 closed

You don’t understand what I’m going for…

I will say it ONE more time. I am sick of writing this…


I want a top door to come down, a side door to move along and then it will tp a player somewhere else, then it will move the side door back to it’s original position and the top door back to it’s original position too.


What are you going for then?
char limit lol