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

How would I make a player teleport by saying something in chat?

I'm working on a game currently and want to add a secret parkour level for a badge. I want players to be able to type, for example, "Yessir" into the chat then teleports them to the parkour and deletes the "Yessir" message (the parkour is a separate place/game.) If anyone could help me that would be awesome!

1 answer

✓ Accepted answer
game.Players.PlayerAdded:Connect(function(player) 
	player.Chatted:Connect(function(msg) 
		if msg == "Yessir" then
			game:GetService('TeleportService'):Teleport(GameID) 
		end
	end)
end)

player.Chatted is a function that detects when the player writes something into chat and msg is a parameter which is what the player typed into the chat.

You can use TeleportService to teleport players to different servers and games

local TeleportService = game:GetService("TeleportService")
TeleportService:Teleport(gameid)

3 comments

0

Thank you, it's appreciated!

0

Where would I put this, server script storage?

0

a script in server script service would work

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