I was wondering, how do I make a script where if a specific player types something in chat, only the player who wrote the "message" in chat will be teleported to a part that I have already positioned in a specific area within the game?
COMMUNITY QUESTION
How do I make a script so that when I chat something I get teleported?
1 answer
Hi There!
Before you can think of doing this, you need to know about the following:
And
Now, we can get to the scripting part.
MAKE SURE YOU ENABLE 3RD PARTY TELEPORT SERVICE INSIDE OF SECURITY!!
So first, you can only teleport players to another Experience you own.
Place the following script in ServerScriptService:
local TeleportService = game:GetService("TeleportService")
local AllowedUsersToTeleport = {game.CreatorId,""} -- Add the users you want to teleport, username or userid.
local TARGET_PLACE_ID = 1818 -- The Target Place ID, It must be owned by you!
game.Players.PlayerAdded:Connect(function(player)
for i,v in pairs(AllowedUsersToTeleport) do
if player.Name == v or player.UserId == v then
player.Chatted:Connect(function(message)
local Text = "Your message here" -- Do not use spaces and make it completely lowercase elsewise it might break.
if message == Text then
TeleportService:TeleportAsync(TARGET_PLACE_ID, player)
if error then
print(error())
return error
end
end
end)
end
end
end)
This discussion is preserved as it was. New answers, comments, and votes are closed.

1 comment
I think Ghostinee is trying to ask how to make a script that teleports you within the same game, not to a different place.