Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to check if player did a obstacle course?

Asked by 5 years ago

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.

dataStore = game:GetService("DataStoreService")
obbyStore1 = dataStore:GetDataStore("ObbyStore1")

-- and such stuff

Is there any better way?

0
If the player touches the finish part, you could signal that they have completed it, no? Using that part's Touched event? Or do you aim to do it a different way? DeceptiveCaster 3761 — 5y
0
You can also increase a number value by 1 at several points on the obby where the player touches a part and then check if the number matches the number it should. This way it is way more difficult to cheat. Azicre 0 — 5y

2 answers

Log in to vote
2
Answered by 5 years ago
Edited by royaltoe 5 years ago

Assuming the script is in a block that detects if they reached it, your script would be:

dataStore = game:GetService("DataStoreService")
obbyStore1 = dataStore:GetDataStore("ObbyStore1")

script.Parent.Touched:Connect(function(hit)
    local player = game.Players:FindFirstChild(hit.Parent.Name)
    if player then
        --check if theyre in the obby datastore
        local hasCompletedObby = obbyStore1:GetAsync(player.UserId)

        --if theyre not in ds/ reward player and add them to the datastore
        if(not hasCompletedObby)then
            --TODO: reward player for completing obby
            obbyStore1:SetAsync(player.UserId)
        end
    end
end)
0
Sorry, this is not what i need, i am needing to know if player did the obstacle course, but points won't add if he will reach it again megamanyoutuber 25 — 5y
0
i updated the post to have the proper answer royaltoe 5144 — 5y
0
this is what i need, but now i need to know how to know total amount of obstacle courses beaten megamanyoutuber 25 — 5y
Ad
Log in to vote
0
Answered by 5 years ago

(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

dataStore = game:GetService("DataStoreService")
obbyStore1 = dataStore:GetDataStore("ObbyStore1")
obbyStore2 = dataStore:GetDataStore("ObbyStore2")
0
i will probably make another question megamanyoutuber 25 — 5y

Answer this question