Hello, people! Pretty simple question but how could I make a ban and unban system using DataStore2? I’m really confused on how to do it. I’ve tried multiple ways but couldn’t find a way to do it. Thanks for any type of help!
Code so far
--// Services
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Players = game:GetService("Players")
--// ReplicaedStorage Variables
local BanRE = ReplicatedStorage:WaitForChild("BanRE")
local DataStore2 = require(ReplicatedStorage:WaitForChild("MainModule"))
--// Other Variables
local BanGui = script:WaitForChild("BanGui")
local Mods = {
1433248963;
}
--// Main
DataStore2.Combine("DATA", "BanDataStore")
local function OnPlayerAdded(LocalPlayer)
local BanDataStore = DataStore2("BanDataStore", LocalPlayer)
local IsBanned = Instance.new("BoolValue")
IsBanned.Name = "IsBanned"
IsBanned.Parent = LocalPlayer
for _, v in pairs(Mods) do
if LocalPlayer.UserId == v then
BanGui:Clone().Parent = LocalPlayer:WaitForChild("PlayerGui")
end
end
-- Don't know what to do after this part
end
Players.PlayerAdded:Connect(OnPlayerAdded)
for _, v in pairs(Players:GetPlayers()) do
OnPlayerAdded(v)
end