RequestAllOrSpecificAdditionalInfoRemoteFunction.OnServerInvoke = function(player, saveID)
local success, errorMessage = pcall(function()
AllAdditionalInfoData = dataStore:GetAsync(player.UserId .. "_AdditionalInfo")
end)
if success and AllAdditionalInfoData then
return AllAdditionalInfoData
else
warn("The Player has no Data!")
return false
end
end
Code for the client side:
It either returns data, {} (the type is a table), or nil.
How can I structure an if statement (on the client side) that accounts for all three? Thanks!
Well, when you’re using an if statement doing: if variable then will respond the same if the variable is false or nil. So that covers all 3 bases. If the data is nil it’ll perform the else function, if the data is false it’ll perform the else function and if the data is a table it’ll perform the function in the if statement