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

How do you make a certain player when chatted, he teleports?

Asked by
Valiux 27
8 years ago

So basically I'm trying to find a script that when a certain defined player in a game (in this case it will be all of the developers.) can be teleported by chatting a certain word. I haven't tried anything yet but I don't really script so...

1
This isn't a request site but here's a link that should help you, http://wiki.roblox.com/index.php?title=API:Class/Player/Chatted User#11440 120 — 8y

2 answers

Log in to vote
1
Answered by 8 years ago

This is a basic answer, All of the below was modified from the roblox wiki which I linked to you earlier.

local Admins = {
    ["Player"] = true;
    ["Player1"] = true;
    ["The_Voids"] = true; ---Add all the admins you want
}

local Spawn = game.Workspace:WaitForChild("SpawnLocation")--Define the spawn location

game.Players.PlayerAdded:connect(function(player)
    if Admins[player.Name] then 
        player.Chatted:connect(function(msg)
            lowerMsg = string.lower(msg)--makes message lowercase. Not needed.
            if lowerMsg == "tp" then ---tp can be whatever. Make sure the letters are lowercase
                player.Character:FindFirstChild("Torso").CFrame = Spawn.CFrame --teleports the player to the Spawn Location
            end
        end)
    end
end

Hope I helped. This has not been tested but should hopefully work. Good Luck

1
you need commas to separate objects in the table TheDeadlyPanther 2460 — 8y
0
Thanks TheDeadlyPanther User#11440 120 — 8y
1
np TheDeadlyPanther 2460 — 8y
Ad
Log in to vote
0
Answered by
Valiux 27
8 years ago

Here, then help, I've tried this. Developers = {"The_Voids", "", ""} function processCommand(speaker, message) -- if someone chatted "tp" if message == "tp" then -- teleport them game.Workspace.Player.Torso.Position = Vector3.new(0, 50, 0) end end

Answer this question