Hi guys theres no output errors but idk why its not saving

LocalScript inside the gui

local GUI = script.Parent

local LocalPlayer = game.Players.LocalPlayer

local Input = GUI.Main_Frame.TextBox
local TextHolder = Input.InfoLabel

local Warn = GUI.Main_Frame.Content_Frame.Warn_Btn
local Kick = GUI.Main_Frame.Content_Frame.Kick_Btn
local GlobalBan = GUI.Main_Frame.Content_Frame.GlobalBan_Btn

local Close = GUI.Main_Frame.Top_Bar.Close_Button

local Available = true
local Target = nil

Close.MouseButton1Click:Connect(function()
	GUI:Destroy()
end)

Warn.MouseButton1Click:Connect(function()
	
	if Target then
		game.ReplicatedStorage.AdminEvent:FireServer("Warn", Target)
	end
	
end)

Kick.MouseButton1Click:Connect(function()
	
	if Target then
		game.ReplicatedStorage.AdminEvent:FireServer("Kick", Target)
	end
	
end)

ServerBan.MouseButton1Click:Connect(function()
	
	if Target then
		game.ReplicatedStorage.AdminEvent:FireServer("ServerBan", Target)
	end
	
end)

GlobalBan.MouseButton1Click:Connect(function()
	
	if Target then
		game.ReplicatedStorage.AdminEvent:FireServer("GlobalBan", Target)
	end
	
end)

Input.Focused:Connect(function()
	
	if not Available then
		
		Input:ReleaseFocus(false)
		
		return
		
	end

	TextHolder:TweenSizeAndPosition(UDim2.new(0,61,0,14), UDim2.new(0,0,.057,0), "Out", "Quad", .1) 

	TextHolder.TextColor3 = Color3.fromRGB(0, 208, 187)

	Input.Line.BackgroundColor3 = Color3.fromRGB(0, 150, 136)

end)

Input.FocusLost:Connect(function()
	
	if not Available then
		
		return
		
	end
	
	Target = nil
	
    if Input.Text == "" then
	
		TextHolder:TweenSizeAndPosition(UDim2.new(0,200,0,19), UDim2.new(-0.06,12,.5,0), "Out", "Quad", .1) 

    	TextHolder.TextColor3 = Color3.fromRGB(231,231,231)

    	Input.Line.BackgroundColor3 = Color3.fromRGB(131, 131, 131)	

    else
		
		for _, Player in pairs(game.Players:GetPlayers()) do
			
			if string.lower(Player.Name) == string.lower(Input.Text) then
				
				print("Target Chosen")
				
				Target = Player
				
			end
			
		end	
		
		if Target and Target.Name == LocalPlayer.Name then
			
			Target = nil
			
			Input.Text = ""
			
			Available = false
			
			TextHolder:TweenSizeAndPosition(UDim2.new(0,200,0,19), UDim2.new(-0.06,12,.5,0), "Out", "Quad", .1) 

    		TextHolder.TextColor3 = Color3.fromRGB(231,91,0)

    		Input.Line.BackgroundColor3 = Color3.fromRGB(131, 131, 131)	
			
			TextHolder.Text = "You cannot set the target to yourself."
			
			wait(2)
			
			Available = true
			
			TextHolder.Text = "Target User"
			
			TextHolder.TextColor3 = Color3.fromRGB(231,231,231)

    		Input.Line.BackgroundColor3 = Color3.fromRGB(111, 111, 111)	
			
			Input.Text = ""

		elseif Target then
			
			TextHolder.TextColor3 = Color3.fromRGB(231,231,231)

   			Input.Line.BackgroundColor3 = Color3.fromRGB(111, 111, 111)
			
		else

			Input.Text = ""
			
			Available = false
			
			TextHolder:TweenSizeAndPosition(UDim2.new(0,200,0,19), UDim2.new(-0.06,12,.5,0), "Out", "Quad", .1) 

    		TextHolder.TextColor3 = Color3.fromRGB(231,91,0)

    		Input.Line.BackgroundColor3 = Color3.fromRGB(131, 131, 131)	
			
			TextHolder.Text = "Player does not exist."
			
			wait(2)
			
			Available = true
			
			TextHolder.Text = "Target User"
			
			TextHolder.TextColor3 = Color3.fromRGB(231,231,231)

    		Input.Line.BackgroundColor3 = Color3.fromRGB(111, 111, 111)	
			
			Input.Text = ""

		end

	end	

end)

GuiClonerHand local script in StarterGui


game.ReplicatedStorage.AdminEvent.OnClientEvent:Connect(function(Gui, Data)
	
	if Gui == "AdminGui" then
		
		local Gui = game.ReplicatedStorage.AdminGui:Clone()
		
		Gui.Parent = game.Players.LocalPlayer.PlayerGui
		
	elseif Gui == "ChatMessage" then
		wait()
		game:GetService("StarterGui"):SetCore("ChatMakeSystemMessage",{
			Text = Data.Text,
			Color = Data.Color,
		})
	end
	
end)

Script AdmiNServerScript and also a folder inside called ServerBannedPlayers

local Admins = {1352379910, -1}

local Group = nil

local GroupRank = nil

local DataStoreService = game:GetService("DataStoreService")
local BanList = DataStoreService:GetDataStore("BanList")

local WarningText = "WARNING: CEASE ACTIONS IMMEDIATELY." 
local Cache = {}

local GetUserId = function(Name)
	
	if Cache[Name] then
		return Cache[Name]
	end
	
	local Player = game.Players:FindFirstChild(Name)
	if Player then
		Cache[Name] = Player.UserId
		return Player.UserId
	end
	
	local Id
	pcall(function()
		Id = game.Players:GetUserIdFromNameAsync(Name)
	end)
	Cache[Name] = Id
	return Id
	
end

local ParseAdmin = function(Player) 
	
	for _, Id in pairs(Admins) do	
		if Player.UserId == Id then	
			return true		
		end	
	end
	
	if Group then	
		if GroupRank then	
			if Player:GetRankInGroup(Group) > GroupRank then
				return true
				
			end	
		else
			if Player:IsInGroup(Group) then		
				return true	
			end	
		end	
	end
	
end

local ParseBanned = function(Name)
	
	local Id = GetUserId(Name)
	
	for _, Object in pairs(script.ServerBannedPlayers:GetChildren()) do
		if Object.Value == Name then
			return "ServerBanned"
		end
	end
	
	local success, Banned = pcall(function()
		return BanList:GetAsync(Id)
	end)
	
	if success and Banned then
		return "GlobalBanned"
	end
	
	return "NotBanned"
	
end

local ParseChat = function(Chat, Player)
	
	local lChat = string.lower(Chat)
	
	if not ParseAdmin(Player) then
		return
	end
	
	if lChat == ";admin" then -- Prefix to open the panel.
		
		game.ReplicatedStorage.AdminEvent:FireClient(Player, "AdminGui")
		
	end
	
	if string.sub(lChat, 1, 8) == ";status" then -- Prefix to check if a player is banned.
		
		local Username = string.sub(Chat, 10, string.len(Chat))
		
		local Banned = ParseBanned(Username)
			
		if Banned == "ServerBanned" then
			game.ReplicatedStorage.AdminEvent:FireClient(Player, "ChatMessage", {Text = Username.." is serverbanned.", Color = Color3.fromRGB(226, 36, 26)})
		elseif Banned == "GlobalBanned" then
			game.ReplicatedStorage.AdminEvent:FireClient(Player, "ChatMessage", {Text = Username.." is globalbanned.", Color = Color3.fromRGB(226, 36, 26)})
		elseif Banned == "NotBanned" then
			game.ReplicatedStorage.AdminEvent:FireClient(Player, "ChatMessage", {Text = Username.." is not banned.", Color = Color3.fromRGB(226, 36, 26)})
		end
			
	end
		
	if string.sub(lChat, 1, 5) == ";unban" then -- Prefix to unban a player.
		
		local Username = string.sub(Chat, 7, string.len(Chat))
		
		local Banned = ParseBanned(Username)
			
		if Banned == "ServerBanned" then
			for _, Object in pairs(script.ServerBannedPlayers:GetChildren()) do
				if string.lower(Object.Value) == string.lower(Username) then
					Object:Destroy()
				end
			end
			game.ReplicatedStorage.AdminEvent:FireClient(Player, "ChatMessage", {Text = Username.." has been unserverbanned.", Color = Color3.fromRGB(226, 36, 26)})
		elseif Banned == "GlobalBanned" then
			local success, Banned = pcall(function()
				return BanList:SetAsync(game.Players:GetUserIdFromNameAsync(Username), false)
			end)
			
			if success then
				game.ReplicatedStorage.AdminEvent:FireClient(Player, "ChatMessage", {Text = Username.." has been unglobalbanned.", Color = Color3.fromRGB(226, 36, 26)})
			else
				game.ReplicatedStorage.AdminEvent:FireClient(Player, "ChatMessage", {Text = "Unbanning operation failed.", Color = Color3.fromRGB(226, 36, 26)})
			end
		end
			
		
	end
	
end

game.ReplicatedStorage.AdminEvent.OnServerEvent:Connect(function(Player, AdminAction, Target)
	
	if ParseAdmin(Player) then
		
		if ParseAdmin(Target) then
			game.ReplicatedStorage.AdminEvent:FireClient(Player, "ChatMessage", {Text = "You cannot moderate other moderators.", Color = Color3.fromRGB(226, 36, 26)})
			return
		end
		
		if AdminAction == "Kick" then
			Target:Kick("You have been kicked by an administrator.")
		elseif AdminAction == "Warn" then
			game.ReplicatedStorage.AdminEvent:FireClient(Target, "ChatMessage", {Text = WarningText, Color = Color3.fromRGB(226, 36, 26)})
		elseif AdminAction == "ServerBan" then
			Target:Kick("You have been banned from this server by an administrator.")
			for _, Object in pairs(script.ServerBannedPlayers:GetChildren()) do
				if Object.Value == Target.Name then
					return
				end
			end
			local ServerBanValue = Instance.new("StringValue")
			ServerBanValue.Name = "ServerBannedUserName"
			ServerBanValue.Value = Target.Name
			ServerBanValue.Parent = script.ServerBannedPlayers
		elseif AdminAction == "GlobalBan" then
			Target:Kick("You have been banned from this game by an administrator.")
			local success, Banned = pcall(function()
				return BanList:SetAsync(Target.UserId, true)
			end)
			
			if success then
				game.ReplicatedStorage.AdminEvent:FireClient(Player, "ChatMessage", {Text = Target.Name.." has been globalbanned.", Color = Color3.fromRGB(226, 36, 26)})
			else
				game.ReplicatedStorage.AdminEvent:FireClient(Player, "ChatMessage", {Text = "Unbanning operation failed.", Color = Color3.fromRGB(226, 36, 26)})
			end
		end
		
	end
	
end)

game.Players.PlayerAdded:Connect(function(Player)
	
	local Banned = ParseBanned(Player.Name)
	
	if Banned == "ServerBanned" then
		Player:Kick("You have been banned from this server.")
	elseif Banned == "GlobalBanned" then
		Player:Kick("You have been banned from this game.")
	end
	
	Player.Chatted:Connect(function(Chat)
		ParseChat(Chat, Player)
	end)
	
end)
	

3 comments

0

I'm pretty sure if you want to store these bans you need a webhook or something, You can't just store a ban from the server and expect it to be in every game

0

you mean a sql base?

0

this is really insecure, exploiters can ban your players for apparent no reasons