Chat commands source code

Source code:

local ChatService = game:GetService("Chat")


local Messages = {
	["1"] = {
	"Hello, welcome to another cookie tech video!", 
	"In todays tutorial, I'm going to show you how you can make an auto training speech command, just like this!",
	},
	["2"] = {
		"Keep in mind, all source code used in todays video are found in the description down below!",
		"With all of the being said, remember to like, subscribe & join the forums!"
	}
}



local Currentmessage = 1

local command = "/start_speech"
local GroupId = 0
local RankId = 0



game.Players.PlayerAdded:Connect(function(player)
	if player:GetRankInGroup(GroupId) >= RankId then
		print("access granted")
		player.Chatted:Connect(function(Message) 
			local SplitString = string.split(Message, " ")
			if SplitString[1] == "/start_speech" then 
				local Message_Set = Messages[SplitString[2]]
				for i, v in Message_Set do 
					ChatService:Chat(player.Character.Head, v)
					wait(#v * 0.15)
				end
			end
		end)
	end
end)


This topic was automatically closed 1 minute after the last reply. New replies are no longer allowed.