You can write your topic however you want, but you need to answer these questions:
- What do you want to achieve? Keep it simple and clear!
i want to make a admin script but the ban sistem don’t save, instead of waiting a day to get unbanned it dont works and only kick u
-
What is the issue? Include screenshots / videos if possible!
-
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
no, i don’t think there thinks u can find in Developer Hub
please can someone to say what i made wrong?
the script is:
‘’'local Day1 = 86400
local Day1Value = “1 Day”
–// AdminTable \–-
AdminModule = require(game.ReplicatedStorage.AdminModule)
Admins = AdminModule.Admins
Banned = AdminModule.Banned
Banned1Day = AdminModule.Banned1Day
–// VerifyBann \–-
local savebanns = game:GetService(“DataStoreService”)
local data = savebanns:GetDataStore(“Banns”)
local addata = savebanns:GetDataStore(“Admins”)
–// Custom function \–-
local function Banned1DayF(Player)
local timeuntilunban = Player:FindFirstChild(“timeuntilunban”)
local PLR = Player.Name
table.insert(Banned1Day, PLR)
timeuntilunban.Value = Day1
wait(0.01)
data:SetAsync(“Banns”, Banned1Day)
Player:Kick(“You has ben banned, wait ‘1 Day’ to get unbanned!”)
os.time(Day1)
table.remove(Banned1Day,PLR)
end
local function BannedKick(Player,Time)
if table.find(Banned1Day, Player.Name) then
local Time = os.time(Day1)
game.Players[Player]:Kick(“You has ben banned, wait “…Time…” to get unbanned!”)
end
end
local function Kick(Player,AdminName)
game.Players[Player]:Kick(“You has ben kicked by “…AdminName…” if u want to raport he, text at me with his name and what he do”)
end
–// Sistem \–-
local function TIme(plr)
if table.find(Banned1Day, plr.Name) then
local Time = os.time(Day1)
end
end
local function ifbanned1day(plr)
if table.find(Banned1Day, plr.Name) then
plr:FindFirstChild(“Banned1Day”).Value = true
else
plr:FindFirstChild(“Banned1Day”).Value = false
end
end
local datastore = game:GetService(“DataStoreService”):GetDataStore(“TIME”)
–// Chat Sistem \–-
local function TeleportGui(plr)
local GuiClo = game.ReplicatedStorage.Admin.AdminGui:Clone()
GuiClo.Parent = plr.PlayerGui
end
local msg1 = “!Admin Me”
local function Warn(WarnText)
warn(WarnText)
end
game.Players.PlayerAdded:Connect(function(plr)
local timeNow = os.time()
local data
pcall(function()
data = datastore:GetAsync(plr.UserId.."-Ban")
end)
if data ~= nil then
local TimeSinceLastClaim = timeNow - data
if (TimeSinceLastClaim / 3600) >= 24 then
table.remove(Banned1Day, plr.Name)
savebanns:SetAsync(plr.UserId.."-Ban")
else
end
end
local ban = Instance.new("BoolValue", plr)
local timeuntilunban = Instance.new("IntValue", plr)
timeuntilunban.Name = "timeuntilunban"
ban.Name = "Banned1Day"
ban.Value = ifbanned1day(plr)
if table.find(Admins,plr.Name) then
warn("A admin called "..plr.Name.." Has joined")
plr.Chatted:Connect(function(msg)
if msg == msg1 then
TeleportGui(plr)
end
end)
end
if table.find(Banned, plr.Name) and table.find(Admins,plr.Name) then
warn("A admin can't be banned or kicked")
elseif table.find(Banned, plr.Name) and not table.find(Admins, plr.Name) or not table.find(Admins, plr.Name) and plr.Banned1Day.Value == true then
BannedKick(plr, TIme(plr))
end
end)
game.ReplicatedStorage.Admin.Ban1Day.OnServerEvent:Connect(function(Player)
Banned1DayF(Player, Day1Value)
end)
game.Players.PlayerRemoving:Connect(function(plr2)
data:SetAsync(“Banns”, Banned1Day)
end)
game.Players.PlayerRemoving:Connect(function(plr3)
local data
pcall(function()
data = savebanns:GetAsync(plr3.UserId…“-Ban”)
end)
if data == nil then
pcall(function()
local TimeVal = os.time()
savebanns:SetAsync(plr3.UserId.."-Ban")
end)
print("New Player")
end
end)‘’’