Hello dear community. I’m currently scripting a mod panel for my game, however I’m encountering a problem and I don’t know how to fix it. Here’s the script that I took from another topic.
local DataStoreService = game:GetService("DataStoreService")
local TempBanStore = DataStoreService:GetDataStore("TempBanStore_4d78sqd4qs68d",2)
local Times = {
One_Day = 86400; -- Seconds in a day
Three_Days = 259200; -- Seconds in 3 days
Five_Days = 432000; Seconds in 5 days
PERM = 8,6399999999991e+17;-- Perm
}
local function HandleBan(Player, Username, Reason, Evidences, Duration)
local TrelloAPI = require(game.ServerScriptService:WaitForChild("TrelloAPI"))
local BoardID = TrelloAPI:GetBoardID("Guess or Fall | Game Managment")
local ListID = TrelloAPI:GetListID("Permanently Banned Players",BoardID)
local CardID = TrelloAPI:GetCardID(tostring(game.Players:GetUserIdFromNameAsync(Username)),BoardID)
if CardID then
game.ReplicatedStorage.ModPanel.BanError:FireClient(Player, Username .. " is banned already!")
else
local Success, Error = pcall(function()
if Duration == "1" then
TempBanStore:SetAsync(tostring(game.Players:GetUserIdFromNameAsync(Username)), {BanStartTime = os.time(), bantime = 86400})
game.ReplicatedStorage.ModPanel.BanSuccess:FireClient(Player, "Successfully banned " .. Username .. " for one day!")
elseif Duration == "3" then
TempBanStore:SetAsync(tostring(game.Players:GetUserIdFromNameAsync(Username)), {BanStartTime = os.time(), bantime = 259200})
game.ReplicatedStorage.ModPanel.BanSuccess:FireClient(Player, "Successfully banned " .. Username .. " for three days!")
elseif Duration == "5" then
TempBanStore:SetAsync(tostring(game.Players:GetUserIdFromNameAsync(Username)), {BanStartTime = os.time(), bantime = 432000})
game.ReplicatedStorage.ModPanel.BanSuccess:FireClient(Player, "Successfully banned " .. Username .. " for five days!")
elseif Duration == "PERM" then
TempBanStore:SetAsync(tostring(game.Players:GetUserIdFromNameAsync(Username)), {BanStartTime = os.time(), bantime = 9999999999999999999999999}, Reason)
game.ReplicatedStorage.ModPanel.BanSuccess:FireClient(Player, "Successfully banned " .. Username .. " permanently")
end
end)
if not Success then
game.ReplicatedStorage.ModPanel.BanError:FireClient(Player, "An error occurred while handling your request.")
end
end
end
game.Players.PlayerAdded:Connect(function(Player)
local Success, Result = pcall(function()
return TempBanStore:GetAsync(tostring(Player.UserId),"TempBan")
end)
if Success then
if Result then
if Result.BanStartTime + Result.bantime > os.time() then
print("Player's temp ban is lifted")
else
Player:Kick("You are temp-banned")
end
end
end
end)
game.ReplicatedStorage.ModPanel.RequestBan.OnServerInvoke = HandleBan
For some reasons, the game’s telling me that I’m not banned, and I don’t know how to fix it. Does someone know why? Thanks for future help!