Recently I've made an addition to a game that allows you to edit your character if you haven't already played the game/if your datastore isn't used yet. Based on this, I have set a value that changes depending on whether or not this person plays the game. If they have played, the value is set to 1. If they haven't played, the value is set to 0. But for some reason, what ends up happening, despite the game telling me that the players datastore is NOT equal to nil, the players value is set to 0, causing them to never be able to play.
Heres the code:
local prefix = 'user_'..Player.UserId
local plrData = Data:GetAsync(prefix .. tostring(Player.UserId))
if plrData then
print 'is'
STVal.Value = 1
QVal.Value = Data:GetAsync(prefix .. tostring(Player.UserId))[1]
CVal.Value = Data:GetAsync(prefix .. tostring(Player.UserId))[2]
TVal.Value = Data:GetAsync(prefix .. tostring(Player.UserId))[3]
SVal.Value = Data:GetAsync(prefix .. tostring(Player.UserId))[4]
IVal.Value = Data:GetAsync(prefix .. tostring(Player.UserId))[5]
TRVal.Value = Data:GetAsync(prefix .. tostring(Player.UserId))[6]
AVal.Value = Data:GetAsync(prefix .. tostring(Player.UserId))[7]
ATVal.Value = Data:GetAsync(prefix .. tostring(Player.UserId))[8]
HVal.Value = Data:GetAsync(prefix .. tostring(Player.UserId))[9]
HCVal.Value = Data:GetAsync(prefix .. tostring(Player.UserId))[10]
SCVal.Value = Data:GetAsync(prefix .. tostring(Player.UserId))[11]
SHVal.Value = Data:GetAsync(prefix .. tostring(Player.UserId))[12]
PAVal.Value = Data:GetAsync(prefix .. tostring(Player.UserId))[13]
elseif plrData == nil then
print'isnt'
STVal.Value = 0
QVal.Value = 0
CVal.Value = 1
TVal.Value = 1
SVal.Value = 1
IVal.Value = 1
TRVal.Value = 1
AVal.Value = 6
ATVal.Value = 30
HVal.Value = 1
HCVal.Value = 1
SCVal.Value = 1
SHVal.Value = 1
PAVal.Value = 1
end
Let me make some things clear. STVal is is the value that I am referring to. The other values can be ignored. I have purposely left some of the code out, to shorten this question. The datastores work fine, it's just that despite a players data not being equal to nil, STVal is still 0! How do I fix this?

2 comments
Seems to work for now. Thanks.
No problem.