Hello, I am making a system where it changes the status when you use the command, but it’s not working for some reason.
local status1 = {"FREE TIME", "ENJOY YOUR FREE TIME, HANG OUT WITH FELLOW INMATES, OR GO ON THE YARD", Color3.fromRGB(255, 255, 255)}
local status2 = {"YARD", "GET SOME FRESH AIR OUTSIDE ON THE YARD", Color3.fromRGB(255, 255, 255)}
local status3 = {"CELL BLOCK", "GO INSIDE YOUR PRISON CELLS FOR THE NIGHT", Color3.fromRGB(255, 255, 255)}
local status4 = {"CANTEEN", "HEAD TO THE CANTEEN AND EAT SOME FOOD", Color3.fromRGB(255, 255, 255)}
local status5 = {"LOCKDOWN", "THE PRISON IS ON LOCKDOWN, GO TO YOUR CELLS!", Color3.fromRGB(255, 0, 0)}
local prefix = "!"
local autoSwitchEnabled = false -- Change this to true if you would like it to automatically cycle through the status'.
local autoSwitchTime = 3 -- Change this to the seconds it takes before it switches between each status. [if you have autoSwitch enabled]
local isGroupLocked = false -- Change this to true if you want it to be group locked.
local groupID = 12345678 -- Change this to your group ID.
local minRank = 255 -- Change this to the minimum rank ID that can use the commands.
game.Players.PlayerAdded:Connect(function(plr)
plr.Chatted:Connect(function(msg)
if autoSwitchEnabled == false then
if isGroupLocked == true then
if plr:GetRankInGroup(groupID) >= minRank then
local args = string.split(msg, " ")
local status = table.concat(args, " ", 2)
local lstatuss = string.lower(status)
local lstatus = string.lower(status1[1])
if args[1] == "!status" then
if status == lstatus then
game.ReplicatedStorage.changeStatus:FireAllClients(status1[1], status1[2], status1[3])
game.Workspace.lockdownAudio:Stop()
end
end
local lstatus1 = string.lower(status2[1])
if args[1] == "!status" then
if status == lstatus then
game.ReplicatedStorage.changeStatus:FireAllClients(status2[1], status2[2], status2[3])
game.Workspace.lockdownAudio:Stop()
end
end
local lstatus2 = string.lower(status3[1])
if args[1] == "!status" then
if status == lstatus then
game.ReplicatedStorage.changeStatus:FireAllClients(status3[1], status3[2], status3[3])
game.Workspace.lockdownAudio:Stop()
end
end
local lstatus3 = string.lower(status4[1])
if args[1] == "!status" then
if status == lstatus then
game.ReplicatedStorage.changeStatus:FireAllClients(status4[1], status4[2], status4[3])
game.Workspace.lockdownAudio:Stop()
end
end
local lstatus4 = string.lower(status5[1])
if args[1] == "!status" then
if status == lstatus then
game.ReplicatedStorage.changeStatus:FireAllClients(status5[1], status5[2], status5[3])
game.Workspace.lockdownAudio:Play()
end
end
end
end
end
if autoSwitchEnabled == false then
if isGroupLocked == false then
local lmsg = string.lower(msg)
local lstatus = string.lower(status1[1])
local args = string.split(msg, " ")
local status = table.concat(args, " ", 2)
if args[1] == "!status" then
if status == lstatus then
game.ReplicatedStorage.changeStatus:FireAllClients(status1[1], status1[2], status1[3])
game.Workspace.lockdownAudio:Stop()
end
end
local lstatus1 = string.lower(status2[1])
if args[1] == "!status" then
if status == lstatus then
game.ReplicatedStorage.changeStatus:FireAllClients(status2[1], status2[2], status2[3])
game.Workspace.lockdownAudio:Stop()
end
end
local lstatus2 = string.lower(status3[1])
if args[1] == "!status" then
if status == lstatus then
game.ReplicatedStorage.changeStatus:FireAllClients(status3[1], status3[2], status3[3])
game.Workspace.lockdownAudio:Stop()
end
end
local lstatus3 = string.lower(status4[1])
if args[1] == "!status" then
if status == lstatus then
game.ReplicatedStorage.changeStatus:FireAllClients(status4[1], status4[2], status4[3])
game.Workspace.lockdownAudio:Stop()
end
end
local lstatus4 = string.lower(status5[1])
if args[1] == "!status" then
if status == lstatus then
game.ReplicatedStorage.changeStatus:FireAllClients(status5[1], status5[2], status5[3])
game.Workspace.lockdownAudio:Play()
end
end
end
end
end)
end)
if autoSwitchEnabled == true then
while true do
game.ReplicatedStorage.changeStatus:FireAllClients(status1[1], status1[2], status1[3])
game.Workspace.lockdownAudio:Stop()
wait(autoSwitchTime)
game.ReplicatedStorage.changeStatus:FireAllClients(status2[1], status2[2], status2[3])
game.Workspace.lockdownAudio:Stop()
wait(autoSwitchTime)
game.ReplicatedStorage.changeStatus:FireAllClients(status3[1], status3[2], status3[3])
game.Workspace.lockdownAudio:Stop()
wait(autoSwitchTime)
game.ReplicatedStorage.changeStatus:FireAllClients(status4[1], status4[2], status4[3])
game.Workspace.lockdownAudio:Stop()
wait(autoSwitchTime)
game.ReplicatedStorage.changeStatus:FireAllClients(status5[1], status5[2], status5[3])
game.Workspace.lockdownAudio:Play()
wait(autoSwitchTime)
end
end
Help would be appreciated.