Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Disable script works but cant enable it after?

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

local admins = {"WillBe_Stoped","imtoogud3322","Baller_Shard","kicksonhurri","conradvibes"
}
local prefix = ":"
local bbscript = script.Parent.BB

game.Players.PlayerAdded:Connect(function(player)
	player.Chatted:Connect(function(msg)
		for i,v in pairs (admins) do
			if bbscript.Disabled == false and v == player.Name and msg == prefix.."disablebb" then
				bbscript.Disabled = true
			elseif bbscript.Disabled == true and v == player.Name and msg == prefix.."enablebb" then
				bbscript.Disabled = false
			end
		end
	end)
end)

1 answer

✓ Accepted answer
local admins = {"PLAYER"}
local prefix = ":"
local bbscript = script.Parent.BB

function checkAdmin(player)
	for i,v in pairs (admins) do
		if player.Name == v then
			return true
		end
	end
end

game.Players.PlayerAdded:Connect(function(player)
	player.Chatted:Connect(function(msg)
		if msg == prefix.."disablebb" and checkAdmin(player) then
			if bbscript.Disabled == false then
				bbscript.Disabled = true
			end
		end
		if msg == prefix.."enablebb" and checkAdmin(player) then
			if bbscript.Disabled == true then
				bbscript.Disabled = false
			end
		end
	end)
end)

This discussion is preserved as it was. New answers, comments, and votes are closed.