-
What do you want to achieve?
I am trying to make a GUI button that puts players who press it into a queue and teleports them to a different place. -
What is the issue?
The Issue is I haven’t found any tutorials on how to do this -
What solutions have you tried so far?
I searched youtube, scriptinghelpers.org, and devforum.
Specific type? (In-game or to another place?)
To another place in asset manager
Assuming you already have the UI for it:
local Player = game.Players.LocalPlayer
local PlaceId = 000000 -- Replace with the place id!
local Button = script.Parent
local Queue = game.Workspace:FindFirstChild("", true) -- Add the queue part the players teleport to in the speech marks, the script will do the rest.
local PlayersToTeleport = {}
Button.MouseButton1Click:Connect(function()
local TS = game:GetService("TeleportService")
Player.Character.HumanoidRootPart.CFrame = Queue.CFrame
table.insert(PlayersToTeleport, Player.Name)
task.wait(10) -- How long the player waits to be teleported.
for i = 1, #PlayersToTeleport do
local CurrentPlayer = PlayersToTeleport[i]
TS:TeleportAsync(game.Players:FindFirstChild(CurrentPlayer), PlaceId)
task.wait(0.01)
if not PlayersToTeleport then
break
end
end
end)
This is a LocalScript inside the button which players click to get teleported. Let me know any issues!
Thanks A lot! I was stuck on this for a couple of hours. I’ll let you know if it works.
Yessir, have a great holiday!
It didn’t end up working because of my camera script for the main menu. Here is the game link so you can see what I mean. I think the camera script keeps teleporting the player back to the main menu position if that makes any sense.
game link:Escape From Tarblox - Roblox
is there any way I can put them in the queue without teleporting them to a part?
You’d have to teleport them to a part, but you could use the touched event in a normal script in the queue, then add them to a table, and take apart my script to teleport them. Something like this:
script.Parent.Touched:Connect(function(hit)
local Player = game.Players:GetPlayerFromCharacter(hit.Parent)
if not Player then return end
local playersToTeleport = {}
table.insert(playersToTeleport, Player.Name)
task.wait(10)
for i = 1, #playersToTeleport do
local CP = game.Players:FindFirstChild(i)
game:GetService("TeleportService"):TeleportAsync(CP, 000000) -- Replace 000000 with your game ID.
end
end)
I believe that would work.
This still hasn’t worked sadly. I even tried making some changes to the scripts to make them compatible with my camera script but that didn’t work either.
Hello, I have made a model for this you can use it here:
let me know if you have any problems
I myself was able to make one using a tutorial from youtube if you have problems I could send the script
Thanks so much. This took longer than I expected. And thanks to everyone else that tried to help as well.