Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local GroupId = 12345 --REPLACE 12345 WITH YOUR GROUP ID
- local MinimumRankToUseCommands = 254 --REPLACE 254 WITH THE MINIMUM RANK ID TO USE THE SLOCK AND UNSLOCK COMMANDS
- local MinimumRankToJoinSlocked = 10 --REPLACE 10 WITH THE MINIMUM RANK ID PLAYERS HAVE TO BE IN ORDER TO JOIN WHEN THE SERVER IS LOCKED
- local ServerLockMessage = "The server is locked! Please try joining again later." --REPLACE THE TEXT INSIDE OF THE "" WITH YOUR SERVER LOCK MESSAGE
- local ServerLocked = false
- game.Players.PlayerAdded:Connect(function(Player)
- Player.Chatted:Connect(function(Message)
- if Player:GetRankInGroup(GroupId) >= MinimumRankToUseCommands then
- if Message == "!slock" then
- ServerLocked = true
- local Players = game.Players:GetPlayers()
- for i = 1, #Players do
- local CurrentPlayer = Players[i]
- local ServerLockMessage = Player.PlayerGui.ServerLockGUI.ServerLockMessage
- ServerLockMessage.Visible = true
- ServerLockMessage.Text = "Server locked for ranks " .. MinimumRankToJoinSlocked .. " and lower."
- wait(5)
- ServerLockMessage.Visible = false
- end
- elseif Message == "!unslock" then
- ServerLocked = false
- local Players = game.Players:GetPlayers()
- for i = 1, #Players do
- local CurrentPlayer = Players[i]
- local ServerLockMessage = Player.PlayerGui.ServerLockGUI.ServerLockMessage
- ServerLockMessage.Visible = true
- ServerLockMessage.Text = "Server Unlocked"
- wait(5)
- ServerLockMessage.Visible = false
- end
- end
- end
- end)
- if ServerLocked == true then
- if Player:GetRankInGroup(GroupId) < MinimumRankToJoinSlocked then
- Player:Kick(ServerLockMessage)
- end
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement