So i’m Making a Ban Gui but my code for entering the player into the datastore is not working?
i’ve went to the DevHub for this and youtube.
my code
local DDS = game:GetService("DataStoreService")
local Players = game:GetService("Players")
local BanStore = DDS:GetDataStore("BanStore1")
local secondsInADay = 86400
local Admins = {
"DeveloperSiverity",
"Renzpalo1",
"chickeip"
}
game.ReplicatedStorage.Ban.OnServerEvent:Connect(function(plr, Player, Reason, Duration)
for i,v in pairs(Admins) do
if plr.Name == v then
local success, Error = pcall(function()
BanStore:SetAsync(game.Players:GetUserIdFromNameAsync(Player), {BanStart = os.time(), BanDuration = (Duration * secondsInADay), banReason = Reason})
print("Entered into Ban Datastore")
end)
game.Players:FindFirstChild(Player):Kick("You have been banned from this game By a admin For "..Reason)
if not success then
warn("Failed")
end
end
end
end)
Only the warn gets passed