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

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

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 comment

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

2 answers

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

3 comments

1

you need commas to separate objects in the table

0

Thanks TheDeadlyPanther

1

np

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

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