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

Script meant to place all via a phrase won't work?

This script is meant to send all players to a certian place when I say a certian phrase but it won't work any ideas why?


game.Players.PlayerAdded:connect(function(player)
    if player.Name == "CybeTech" then
        player.Chatted:connect(function(msg)
	if msg == "Phrase" then
		for _, Plrs in pairs(game.Players:GetPlayers()) do
game:GetService("TeleportService"):Teleport(PlaceID, Plrs)
		end
	end
end)

1 comment

0

Look at the output after you test the place.

1 answer

This should work.

game.Players.PlayerAdded:connect(function(plr)
	game.Players:WaitForChild(plr.Name)
	if plr.Name == "CybeTech" then
		plr.Chatted:connect(function(msg)
			if msg:sub(1, 6) == "phrase" then
				for _, itm in pairs(game:GetService'Players':GetChildren()) do
					game:GetService'TeleportService':Teleport(PlaceID, itm)
				end
			end
		end)
	end
end)

I think you should be checking the message using msg:sub(start, end). Anyways, I hope this helped.

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