I want a command that is !metserver and it will tp them to a server with Met training it in. Like how pinewood has !petserver that tps them to the pet server were they can host things. I still want the players to stay in the main game but just move to other server. I can also work with a place inside the game.
I am not sure how to make this.
I have tryed to find this on youtube. And nothing.
Please note: If I reply to you late it is because I have not seen your reply and it is late for me.
I also reall dont have a clue on how to code so try to be as clear as you can.
local players = game:GetService("Players")
local teleports = game:GetService("TeleportService")
local placeId = 0 --Change to ID of destination.
players.PlayerAdded:Connect(function(player)
player.Chatted:Connect(function(message)
if message:lower() == "!metserver" then
if player.UserId == game.CreatorId then
teleports:TeleportPartyAsync(placeId, players:GetPlayers())
end
end
end)
end)
local players = game:GetService(“Players”)
local teleports = game:GetService(“TeleportService”)
local placeId = 8850015739 --Change to ID of destination.
players.PlayerAdded:Connect(function(player)
player.Chatted:Connect(function(message)
if message:lower() == “!metserver” then
if player.UserId == game.CreatorId then
teleports:TeleportPartyAsync(placeId, players:GetPlayers())
end
end
end)
end)
Those errors aren’t even related to the script, I recommend you test in an empty environment. You can’t teleport in studio but you’ll get a console warning indicating as such.
Needs to be the chatters ID (for the command to work). If you want to make this command available to multiple users then you could implement a whitelist.
local players = game:GetService("Players")
local teleports = game:GetService("TeleportService")
local placeId = 0 --Change to ID of destination.
local whitelisted = {1, 2, 3} --Add user IDs here.
players.PlayerAdded:Connect(function(player)
player.Chatted:Connect(function(message)
if message:lower() == "!metserver" then
if table.find(whitelisted, player.UserId) then
teleports:TeleportPartyAsync(placeId, players:GetPlayers())
end
end
end)
end)
In that case, remove the conditional check entirely.
local players = game:GetService("Players")
local teleports = game:GetService("TeleportService")
local placeId = 0 --Change to ID of destination.
players.PlayerAdded:Connect(function(player)
player.Chatted:Connect(function(message)
if message:lower() == "!metserver" then
teleports:TeleportPartyAsync(placeId, players:GetPlayers())
end
end)
end)