Add a script into ServerScriptService.
player.Chatted fires when a player writes in chat.
game.Players.PlayerAdded:Connect(function(player)
player.Chatted:Connect(function(msg)
end)
end)
game.Players.PlayerAdded:Connect(function(player)
player.Chatted:Connect(function(msg)
if string.sub(msg, 0,1) == "(your command prefix)" then
end
end)
end)
string.sub takes a part of a string string. The string is a variable called "msg". So when we use string.sub(msg, 0,1), we only look at the first letter of the string. If the player writes "Hello", it's gonna end the script, but if the player writes "/hello", it's gonna continue into the if statement.
game.Players.PlayerAdded:Connect(function(player)
player.Chatted:Connect(function(msg)
if string.sub(msg, 0,1) == "(your command prefix)" then
if string.sub(msg, 2) == "reset" then
player:LoadCharacter() -- This is just and example. You can use whatever command you'd like
end
end
end)
end)