I have introduced a new moderation system to my game. If you have been banned, you will be forced to appeal by paying a sum of robux. When paid, a hidden leaderstat in the player called "BannedBefore" will be set to true. This makes it so if you get banned again, you get kicked instantly without getting another chance to appeal. However, this stat doesn't appear to save.

This is the datastore script that saves your BannedBefore value:

local store_key = "key"
local data_key = "Savedata"

plr_store = game:GetService("DataStoreService"):GetDataStore(store_key)

game.Players.PlayerAdded:connect(function(new_plr)
	local stats = script.Status:Clone()
	stats.Parent = new_plr
	local stat_table = stats:GetChildren()
	local save_data = plr_store:GetAsync(new_plr.userId..data_key)
	if save_data ~= nil then
		for number,data in pairs(stat_table) do
			for s_number,s_data in pairs(save_data) do
				if data.Name == s_data[1] then
					local loaded_val = s_data[2]
					if loaded_val ~= nil then
						data.Value = loaded_val
					end
				end
			end
		end
	end
end)

game.Players.PlayerRemoving:connect(function(plr)
	local stat_table = plr.Status:GetChildren()
	local save_table = {}
	for number,data in pairs(stat_table) do
		table.insert(save_table,{data.Name,data.Value})
	end
	plr_store:UpdateAsync(plr.userId..data_key, function() return save_table end)
end)

And here is a template for my ban script:

local pending = "Your appeal request is pending, please wait for it to be approved before you can play again."
	local denied = "Your appeal request was denied. You have been permanently banned from the game."
	local secondban = "You have been banned before. You may not appeal again. You have been permanently banned from the game."
	local instantban = "You have been permanently banned from the game. You will not have an opportunity to appeal."
	 
	game.Players.PlayerAdded:Connect(function(plr)
	    if plr.Name == ("PLYRNAME") then
	    if plr:WaitForChild("Status").BannedBefore.Value == true then
	        plr:Kick(pending)
	    else
        local c = script.ExploitBanGui:Clone()
	        c.Parent = plr.PlayerGui
        end
 end
end)

Any help is appreciated!

2 comments

0

I know a big developer who wanted to do these ban appeals for robux once, roblox wrote him an e-mail asking to remove this feature.

0

Okay