So i am doing a game, and i need for it to check, if player did the obstacle course, well, i could use data stores, but it won't be as effective as it needs to.
1 | dataStore = game:GetService( "DataStoreService" ) |
2 | obbyStore 1 = dataStore:GetDataStore( "ObbyStore1" ) |
3 |
4 | -- and such stuff |
Is there any better way?
Assuming the script is in a block that detects if they reached it, your script would be:
01 | dataStore = game:GetService( "DataStoreService" ) |
02 | obbyStore 1 = dataStore:GetDataStore( "ObbyStore1" ) |
03 |
04 | script.Parent.Touched:Connect( function (hit) |
05 | local player = game.Players:FindFirstChild(hit.Parent.Name) |
06 | if player then |
07 | --check if theyre in the obby datastore |
08 | local hasCompletedObby = obbyStore 1 :GetAsync(player.UserId) |
09 |
10 | --if theyre not in ds/ reward player and add them to the datastore |
11 | if ( not hasCompletedObby) then |
12 | --TODO: reward player for completing obby |
13 | obbyStore 1 :SetAsync(player.UserId) |
14 | end |
15 | end |
16 | end ) |
(this is repeating of commect i posted) Ok thanks, now i know if player already did the obstacle course, but i need to know total amount of obstacle courses, because it's not just 1 obby
1 | dataStore = game:GetService( "DataStoreService" ) |
2 | obbyStore 1 = dataStore:GetDataStore( "ObbyStore1" ) |
3 | obbyStore 2 = dataStore:GetDataStore( "ObbyStore2" ) |