Hello, so I’m making a roblox game about when a player dies 5 times, they get banned for 10 minutes. The death system is basically 1 death = 1 bp. I want to make it so when the player gets 5 bp, they get banned but my ban script isn’t working. I tried searching it up on the devforums, yet no luck. Here’s my script to ban users: Pastebin.com - Locked Paste Password for this paste is: yQwU9ZRP8r. My other script is to detect when a user has 5 bp. Here’s that script: Pastebin.com - Locked Paste Password for this one is: dP4KuayKbR.
if val == true then
this seems quite unneeded for, same for:
if player:WaitForChild("leaderstats"):WaitForChild("bp").Value >= 5 or player:WaitForChild("leaderstats"):WaitForChild("bp").Value == 5 then
>=
is the same as >
and ==
, it means greater or equal to.
banStore:SetAsync("UserBan"..player.UserId, 200)
player:Kick("oh no something went wrong")
Well so here is the problem. You put in the time they get banned for, but only for how long so only the dt
, instead you want to include the normal time as well so:
os.time() + 200 -- how long you want them to be banned for
Oh yeah I suggest to instead use tick() or a different os.time()
method, because if I am not mistaken it differs depending on the server’s region so the player could have to wait an extra few hours if not done correctly. Unless he joins the exact same server region.
(Actually not sure which one it is, I like to test it with print(os.time() - tick())
, let’s say my timezone is GMT+4 then the result would be something along the lines of 4
or 3.999
, if this is the case then use tick()
if it’s negative use os.time()
)
Thank you, but that doesn’t fix how the ban should work. I’m genuinely confused on how the os.time() thing works, and I know that
local bannedTime = banStore:GetAsync("UserBan"..player.UserId)
if bannedTime and os.time() < bannedTime[2] then
is DEFINITELY wrong, and I also don’t know where to put the os.time() + 200
.