Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Disable script works but cant enable it after?

Asked by 6 years ago

So I made this script. When an admin says a word called ":disablebb" it should disable a script and also when an admin says ":enablebb" then it should enable the script. However, when i do :disablebb everything works it disables the script and everything. BUT when i do :enablebb it doesn't enable the script -script

01local admins = {"WillBe_Stoped","imtoogud3322","Baller_Shard","kicksonhurri","conradvibes"
02}
03local prefix = ":"
04local bbscript = script.Parent.BB
05 
06game.Players.PlayerAdded:Connect(function(player)
07    player.Chatted:Connect(function(msg)
08        for i,v in pairs (admins) do
09            if bbscript.Disabled == false and v == player.Name and msg == prefix.."disablebb" then
10                bbscript.Disabled = true
11            elseif bbscript.Disabled == true and v == player.Name and msg == prefix.."enablebb" then
12                bbscript.Disabled = false
13            end
14        end
15    end)
16end)

1 answer

Log in to vote
1
Answered by 6 years ago
Edited 6 years ago
01local admins = {"PLAYER"}
02local prefix = ":"
03local bbscript = script.Parent.BB
04 
05function checkAdmin(player)
06    for i,v in pairs (admins) do
07        if player.Name == v then
08            return true
09        end
10    end
11end
12 
13game.Players.PlayerAdded:Connect(function(player)
14    player.Chatted:Connect(function(msg)
15        if msg == prefix.."disablebb" and checkAdmin(player) then
View all 26 lines...
Ad

Answer this question