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

Need Help With Chat Activated Teleport?

Asked by
Zjyuak -1
4 years ago

Hello, Im trying to make a script where you say a word in the chat and it teleports you to another game. Im having troubles doing it, could anybody help me. Thanks

1 answer

Log in to vote
0
Answered by
Sparks 534 Moderation Voter
4 years ago

You should use the Player.Chatted event, alongside TeleportService.

local Players = game:GetService("Players")
local TeleportService = game:GetService("TeleportService")
local chatcommand = "/teleport" --change to whatever you want
local destinationID = 00000 --Change to destination place ID

Players.PlayerAdded:Connect(function(player)
    player.Chatted:Connect(function(message)
        if message:sub(1, chatcommand:len()):lower() == chatcommand then
            TeleportService:Teleport(destinationID, player)
        end
    end)
end)
0
OMG YOU JOIN 2007 iivSnooxy 248 — 4y
Ad

Answer this question