How do you make a !rejoin cmd? So that when I am in my game all I have to do is say in chat "!rejoin" and it makes me rejoin the same game.
✓ ANSWER ACCEPTED
How do you make a cmd for players to use? (!rejoin)
1 answer
✓ Accepted answer
You can use the .Chatted event from Player.
Try something like this:
local Players = game:GetService("Players")
local function playerAdded(Player)
Player.Chatted:Connect(function(Message)
if Message == "!rejoin" then
-- Rest of code:
-- Use TeleportService to have the player rejoin the game.
-- https://developer.roblox.com/en-us/api-reference/class/TeleportService
end
end)
end
Players.PlayerAdded:Connect(playerAdded)
This discussion is preserved as it was. New answers, comments, and votes are closed.
