Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

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

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

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

1 comment

0

This still didn't help, I mainly need help with checking the value properly, and identifying the player and their leaderstats without PlayerAdded.

This discussion is preserved as it was. New answers, comments, and votes are closed.