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
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
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)
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
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.
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)
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.