Hello!
I wrote the slock script below:
local Events = script.Parent:WaitForChild('Events')
local Slock = Events:WaitForChild('Slock')
local Config = require(script.Parent:WaitForChild('Configuration'))
local Players = game:GetService('Players')
local SlockMessage = script.Parent.GUI.SlockMessage
local SlockEnabled
local Prefix = Config.Prefix
SlockEnabled = Config.StartLocked
Players.PlayerAdded:Connect(function(Player)
SlockMessage:Clone().Parent = Player.PlayerGui
local Rank = Player:GetRankInGroup(Config.GroupID)
if SlockEnabled and Rank < Config.MinRank then
Player:Kick(Config.KickMessage)
end
Player.Chatted:Connect(function(Message)
Message = string.lower(Message)
if Rank >= Config.AdminRank then
if Message == Prefix..'slock on' and SlockEnabled then
SlockEnabled = true
if Config.SlockMessage then
Slock:FireAllClients(true,Config.SlockLockMessageContent)
end
elseif Message == Prefix..'slock off' and not SlockEnabled then
SlockEnabled = false
if Config.SlockMessage then
Slock:FireAllClients(false,Config.SlockUnlockMessageContent)
end
end
end
end)
end)
When I run :slock on
, it doesn’t work!
I don’t get any errors! Why does this happen?