I read the page for os time and I wonder if I could make a bonus like give the player points every time they play every day.
I think it should work like this:
game.Players.PlayerAdded:connect(function(player)
if player:WaitForDataReady() and player:LoadNumber("TimeSinceLastOn") < os.time(day) then
player.leaderstats.Points = player.leaderstats.Points +10
end
end)
game.PlayerRemoving:connect(function(player)
player:SaveNumber("TimeSinceLastOn", os.time(day))
end)
game.OnClose:connect(function()
wait(30)
end)
--Am I close? How would I do this for hours, years, minutes, or seconds even?
So would this work as a ban script?
game.Players.PlayerAdded:connect(function(plyr)
local banned = false
if plyr:WaitForDataReady() and plyr:LoadNumber("BanTimeLeft") >= 0 then
print(plyr.Name..", don't curse again.")
elseif plyr:LoadBoolean("IsBanned") and BanIfCurse then
Instance.new("Message", plyr).Text = "You're banned for cursing. You may play again after: "..plyr:LoadNumber("BanTimeLeft")
end
plyr.CharacterAdded:connect(function(char)
plyr.Chatted:connect(function(chat, chatter)
if chat == "[Content Deleted]" and BanIfCurse then
plyr:SaveBoolean("IsBanned", true)
plyr:SaveBoolean("BanTimeLeft", BanTime)
plyr:Kick()
else
end
end)
end)
end)

5 comments
So how could I turn this into a temporary ban script?
Pretty much the same. Store a "bannedUntil" and check is the current time is before that time. (If not set, :LoadNumber returns 0, which is 1970, which now is not before, so you don't need any special case for new players)
Blue, I edited my question and I added an unfinished script, I don't know how to finish it. Most of it isn't right, I know. I just need help with the ban part.
@Blue would this still work if the player entered a different server?
Yes, excepting caches -- they might be able to join one server, quick, join another, be banned, then join that first server. But that is not a deficiency of the script, it's just that