Hello,
As the developer of a group, I needed a permanent server lock system who permanently let enter every player with rankID higher or equal 40 in the group, and who can be disabled with a command (/unlock) to let people under the rankID 40 to enter in the server, and who can be re-enable with an another command (/lock) to re-set the limit to the rankID 40.
The issue is when I use the unlock command it won’t work, but the lock command work perfectly:
I’ve set lock to false, then the unlock command worked perfectly, but the lock command stopped working, I’m kinda lost, that’s why I’m asking your help.
local minRank = 40
local groupID = 5912393
local lock = true
game:GetService("Players").PlayerAdded:Connect(function(plr)
if lock == true and plr:getRankInGroup (groupID) < minRank then
plr:kick ("The server is locked")
end
plr.Chatted:connect(function(msg)
if plr:GetRankInGroup(groupID) >= minRank then
if msg == "/lock" then
lock = true and print("locked")
end
if msg == "/unlock" then
lock = false and print("unlocked")
end
end
end)
end)
The script don’t let people under the rankID 40, I’ve tested it.