Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How can I script an elevator that teleports you to another game?

Asked by 4 years ago

I want to create a game but I don't know how can I script an elevator that teleports you to another game when 20 seconds has passed. (And the people can't join to the elevator if it's full) Thank you for helping me.

1
This is not a request site. User#834 0 — 4y

2 answers

Log in to vote
1
Answered by
Syclya 224 Moderation Voter
4 years ago

TeleportService is a start, and eventually check how many players that can be there. https://developer.roblox.com/en-us/api-reference/class/TeleportService

Ad
Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

local tp = game:GetService("TeleportService") local gameid = 00000000 -- Put The ID of the other game local time = 20 -- Time until Teleport

script.Parent.Touched:Connect(function(hit) if hit.Parent:FindFirstChild("Humanoid") ~= nil then local chr = hit.Parent else if hit.Parent.Parent:FindFirstChild("Humanoid") ~= nil then local chr = hit.Parent.Parent end end local plr = game.Players:GetPlayerFromCharacter(chr) wait(20) tp:Teleport(gameid,plr) end)

Answer this question