Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 3 years ago

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

Log in to vote
0
Answered by 3 years ago
Edited 3 years ago
1game.Players.PlayerAdded:Connect(function(player)
2    player.Chatted:Connect(function(msg)
3        if msg == "Yessir" then
4            game:GetService('TeleportService'):Teleport(GameID)
5        end
6    end)
7end)

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

1local TeleportService = game:GetService("TeleportService")
2TeleportService:Teleport(gameid)
0
Thank you, it's appreciated! DJTwisted_2 0 — 3y
0
Where would I put this, server script storage? DJTwisted_2 0 — 3y
0
a script in server script service would work CountOnMeBro 51 — 3y
Ad

Answer this question