Hi! I'm working on a cross-server serverlock. I started by using a datastore. It will be updated when someone with rank 14 or higher says ;slock, then the datastore would get updated... This is what I currently have:
local DataStoreService = game:GetService("DataStoreService")
local LockStore = DataStoreService:GetDataStore("ServerLock")
game.Players.PlayerAdded:connect(function(player)
player.Chatted:connect(function(msg)
if player:GetRankInGroup(3809918) >= 14 then
if msg == ";slock" then
print("slock cmd")
local success = pcall(function()
return LockStore:UpdateAsync("Lock", true)
end)
if success then
local msg = Instance.new("Hint")
msg.Text = "Servers locked"
msg.Parent = workspace
else
local msg = Instance.new("Hint")
msg.Text = "Failed to lock servers"
msg.Parent = workspace
end
end
end
end)
end)
I already created the datastore. It always says "Failed to lock servers" on the top... What am I doing wrong? There is no output. Thanks for your help, Jonas
