✓ Accepted answer
You could probably set up a datastore key to check if it is "nil" or nothing at all. If it is, then it sets the user value to 0. After the event happens, you could most likely set the value to 1. Therefore, if it happens again, it'll stay 1. Some code you can use is:
Set DataStore. This one is fairly easy and all I do is make it a local variable. The format for this would be:
local Datastore = game:GetService("DataStoreService"):GetDataStore("INSERT NAME HERE")
If the player is new to the Datastore, set it to 0. GetAsync fetches the data (since there is nothing there for the player, it is nil), while SetAsync sets the new value of it for the player.
game.Players.PlayerAdded:connect(plr)
if Datastore:GetAsync(plr.userId) == nil then
Datastore:SetAsync(plr.userId, 0)
end
end
If the player does an event, set it to 1.
DataStore:SetAsync(plr.userId, 1)
Similarly, you can also set the Datastore's to different things as well. You could probably set it to 2 if you want to. As always, you can change the local variable name or the key. For example, if you wanted the key to be: user_[insert playerID]. Then you would replace plr.userId in the sample codes with "user_ .. plr.userId". I recommend setting it so that it is the userId rather than the name itself due to roblox name changes. I haven't tested this script yet (no access to computer so tell me if the tabs seem okay) so tell me if there's any problems.
2 comments
It would help if you did what you could. Obviously you should know you'll start out with the PlayerAdded event.
You should post the code