I'm wondering, how to give a player in-game points everyday? I've checked the wiki, but people could leave and rejoin the game alot to get lots of points, but how do you restrict it to only once a day? I know you can't use
wait(86400)
because the player will have to be in the game for 24 hours. So how?
local DataStore = game:GetService("DataStoreService"):GetDataStore("Points")
game.Players.PlayerAdded:connect(function(player)
local key = "user_".. player.userId
DataStore:UpdateAsync(key, function(oldValue)
local newValue = oldValue or 0
newValue = newValue + 50
end)
end)
and I mixed it with this :
local points = game:GetService("DataStoreService"):GetDataStore("Points")
local text = script.Parent.TextLabel
while wait() do
text = "Coins : ".. points
end
one of the scripts is not working because when I join it doesn't show that I have 50 credits.

2 comments
Which one do you suggest I use? I need an answer because I'm trying to get this game finished near Halloween because of its theme
I, personaly, would use the second method as it uses less DataStore requests, you would just need to chage how you get and set points.