Answered by
5 years ago Edited 5 years ago
Hey, i am learning to work with data stores too, right now, and im also using this article as base, but i am getting an error in the "setupPlayerData" funtion when it tries to get
1 | local data = playerData:GetAsync(playerUserId) |
the error says
1 | 502 : API Services rejected request with error . HTTP 403 (Forbidden) |
It is very mysterious to me why the fuck this is happening. If it happens to you too pls advise me so i'm sure it is not my code. Else I looked about this error and it only use to happen when API services or HTTP requests are disabled or when the dev is on teamcreate, and that's none of them my case. I read that sometimes this errors show up for some time randomly, but im affraid it never goes out cause it is like this since yesterday.
Pls feedback me if you are getting this error too (if you already scripted that part)!
And about your question, looks like it is already answered, the purpose of that code is to check if the value you are saving in the table is of the same type than the value that is already there (number, string, object, etc), so it will prevent you from making something like:
1 | sessionData [ "ColorOfHead" ] = sessionData [ "ColorOfHead" ] + 1 |
-- and get an error
-- so if is not a number, it will update the data like this:
1 | sessionData [ "ColorOfHead" ] = "String" |