What do you want to achieve? Make chat to teleport to another game.
What is the issue? Errors. TeleportOptions
What solutions have you tried so far? Yes but there were no solutions.
local messageRequired = "!Training" --here the name of the command
local player = game:GetService("Players")
local TeleportService = game:GetService("TeleportService")
local TARGET_PLACE_ID = 1234 -- replace with your own place ID
local playerToTeleport = player:GetPlayers()[1] -- get the first user in the experience
player.Chatted:Connect(function(message)
if message == messageRequired then
if player:GetRankInGroup(13566661) >= 3 then
TeleportService:TeleportAsync(TARGET_PLACE_ID, {playerToTeleport}, teleportOptions)
end
end
end
end)
Well, there’s no teleportOptions variable then. I don’t think you would need it though. I barely use teleportservice so I don’t know how to make those options, you should look at this article.
local ts = game:GetService("TeleportService")
game.Players.PlayerAdded:Connect(function(player)
player.Chatted:Connect(function(message)
if player:GetRankInGroup(13566661) >= 3 then
if message:lower() == "!training" then
ts:Teleport(12120116189, player)
end
end
end)
end)
local GameId = 12120116189 --Set this gameId to what game you want to teleport to.
game.Players.PlayerAdded:Connect(function(player)
player.Chatted:Connect(function(Msg)
if Msg == "!training" then --Customize command.
TeleportService:Teleport(GameId, player)
end
end)
end)