Basic ''Teleport'' via Script instead of LocalScript?

Hey there. I’m currently working on one of those elevator games, and I want to make a script that will teleport players back into the elevator after a certain duration of time. Ideally, I want this script to fit into my existing code, which works quite well. I will post the script for reference.

Thank you for taking the time to look at this!

local ElevatorDoor = game.Workspace.Elevator.FakeElevatorDoor
local ElevatorDing = game.Workspace.Sounds.ElevatorSpeaker.ElevatorDing
local ElevatorDoorOpenClose = game.Workspace.Sounds.ElevatorSpeaker.ElevatorDoorOpenClose
local ElevatorMusic = game.Workspace.Sounds.ElevatorSpeaker["Elevator Music"]
local ElevatorScript = game.Workspace.ElevatorDoorRig.Humanoid.ElevatorScript


--Elevator Loop
while true do
	ElevatorMusic:Stop()
	print("Elevator Doors Opening!")
	ElevatorDing:Play()
	wait(2)
	ElevatorDoorOpenClose:Play()
	wait(2)
	ElevatorScript.Disabled = false
	--ElevatorDoor.Transparency = 1
	wait(60)
	--Code goes here to randomize which floor appears.
	ElevatorDoorOpenClose:Play()
	wait(3)
	print("Elevator Doors Closing!")
	-- Code should go here to teleport players back into the elevator.
	ElevatorScript.Disabled = true
	ElevatorMusic:Play()
	wait(20)
	
end
  1. Please do not use game.Workspace just use workspace
  2. Replace the wait statements with task.wait()
  3. Just put a part in the elevator make it invisible and anchor it then teleport everyone to that part when however long time has passed
1 Like