Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How do I make a script so that when I chat something I get teleported?

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?

1 answer

Hi There!

Before you can think of doing this, you need to know about the following:

TeleportService

And

Teleport

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)

1 comment

0

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

This discussion is preserved as it was. New answers, comments, and votes are closed.