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

How to make an event happen depending on a datastore value?

Asked by
2_MMZ 1059 Moderation Voter
3 years ago

Hello, in my game, depending on which value the player has, 0-4, it unlocks a different level. When the first cutscene ends, it'll go to the level selection, and then use the script that detects the players leaderstats. As so here:

game.Players.PlayerAdded:Connect(function(coolguy)
        if coolguy.leaderstats.Cash.Value == 0 then
              --my code would go here.
        end
end)

Upon the script being ran (undisabled) when the player gets to the menu, it does nothing at all. (It's nothing wrong with the datastore.)

Any working answer is appreciated, thanks!

1 answer

Log in to vote
0
Answered by 3 years ago
if a == 0 then --This only checks if the value is equal to 0 not above or equal to
if a > 0 then -- This checks if the value is above 0
if a >= 0 then -- This checks if the value is above 0 or equal to 0
0
This still didn't help, I mainly need help with checking the value properly, and identifying the player and their leaderstats without PlayerAdded. 2_MMZ 1059 — 3y
Ad

Answer this question