Hello, I try to make whenever you die in-game you get banned for 25 minutes and for some odd reason the script that I trying to run is not working. Can you tell me how to fix it? Or maybe I’m putting it in the wrong place or using the wrong type of script or it’s the script itself.
Script:
local bannedPlayers = {}
game.Players.PlayerDied:Connect(function(player)
local playerId = player.UserId
local time = os.time()
bannedPlayers[playerId] = time + 1500
player:Kick(“You have been banned for 25 minutes.”)
end)
game.Players.PlayerAdded:Connect(function(player)
local playerId = player.UserId
local banTime = bannedPlayers[playerId]
if banTime and banTime > os.time() then
player:Kick(“You are still banned for “…math.ceil((banTime - os.time()) / 60)…” minutes.”)
end
end)
That isnt the fully scope of why it isnt working, he’s not even saving the banned players table so it has no data to compare it to when the player joins the game
You have to save the banned player table using some sort of data saving method and then load it when the player joins so you can see if they have data in it or not