Thanks for the suggestion! I tried adding a wait to that section, but unfortunately, it did not make any difference.
if storedSurvey ~= configLine.Survey then
wait(5)
print(configLine)
Thanks for the suggestion! I tried adding a wait to that section, but unfortunately, it did not make any difference.
if storedSurvey ~= configLine.Survey then
wait(5)
print(configLine)
Is the table being wrote to during runtime or is it a predefined table?
If a table isn’t fully printing in the output, it means some of the keys you want have to been set to nil or not defined.
Check that your table is actually setting these values (if you dont want them to be nil). Maybe by using print statements around your if statements to make sure code is being reached
(Of course I dont have much to go off so I’m making educated guesses)
Code should be deterministic every time it runs (unless you use math.random) which means there’s something going wrong with the Survey object’s creation
The Table is within a ModuleScript inside of ReplicatedStorage. If I understand correctly, it’s a predefined table, because it’s already saved in a file, not created upon start.
If the Table is defined with a ModuleScript already as
local Configuration = {
{Survey = 1, ID = 1, Question = "How much do you enjoy the Gameplay?", ResponseType = "Rate"},
}
How would I check the Table is setting these Values?
I believe the above-printed Table might be clarifying that the Table is setting SOME values, but not all of them.
repeat task.wait() until #Configuration == 4
Huh, I thought this would actually be the solution! Unfortunately, it seems like the loop will just go on forever when this issue randomly happens.
local storedSurvey = 0
repeat task.wait() print(#surveyConfig) until #surveyConfig > 4
for _, configLine in ipairs(surveyConfig) do
06:59:55.845 Gifts - Client - CurrencyDisplay:13
06:59:55.846 ▶ 1 (x68) - Client - SurveyHandler:51
06:59:56.978 Coins - Client - CurrencyDisplay:13
06:59:56.979 ▶ 1 (x64) - Client - SurveyHandler:51
06:59:58.044 BattlePass_Level - Client - CurrencyDisplay:13
06:59:58.045 ▶ 1 (x2686) - Client
That means that something is for whatever reason removing entries from that table.
Could 2 scripts require it at the same time cause that? I’m really not sure what would be causing entries to be removed because it’s only even called in 2 places.
I’ve tried further debugging this issue, but still haven’t found any viable solution. Might anyone have any other ideas?
the values shouldnt change
the only reason you can change it between server scripts, or between local scripts, is because the cached value is changed, not the value in the module
what does the if statement around the print do? maybe that’s triggering sometimes and not on other times?
Are you referring to the following?
If so, this is meant as a way to add multiple Surveys to a GUI, without adding the same Survey twice.
I was referring to the table being changed dynamically in whatever source script it’s pulled from.
maybe it’s related to this? Nonstring indices of a keyed table are converted to strings when sent through a remote - #11 by tnavarts
try making ID and Survey have string values and convert them to strings later
Dang, I was really excited when I saw this because I thought the issue and/or a solution might’ve finally been found!
Unfortunately even making all my ID & Surveys have String values, the issue can still occur.
{Survey = "1", ID = "1", Question = "How much do you enjoy the Gameplay?", ResponseType = "Rate"},
{Survey = "1", ID = "2", Question = "How likely are you to recommend Santa Simulator to a Friend?", ResponseType = "Rate"},
It’s really odd too because it still only gets the last two keys!
[1] = ▼ {
["Question"] = "How much do you enjoy the Gameplay?",
["ResponseType"] = "Rate"
}
} - Client - SurveyHandler:49
02:21:49.579 ▶ 1 (x117) - Client - SurveyHandler:51
I still haven’t discovered the reasoning behind the issue, but I did find a hopefully only temporary fix, which was to just add the Table directly to the File, rather than calling it from the ModuleScript.
in the module, is it doing any operations besides return configuration
?
Well first of all, if it does work sometimes then it is most likely an issue with another thread writing to the table before you pull and read from it in that thread. However you have given us little code to go off in order to debug the other possible thread that might be causing this irritant.
So instead ill recommend you something else. The debugger is really good for these scenarios. With it you can follow your script in real time and see all the changes to your values and so forth. I would place down a breakpoint somewhere in that area of code and just follow your script down its lines of logic. Look for anything that might seem to be peculiar, and when you find something get back to us and post your findings.
Ok… I won’t lie, I’m pretty embarrassed to admit this.
Thanks to XX1Luffy1XX’s reply, I decided to look at the Script in Studio to start the debug process.
I use Rojo and have everything synced up while using VSCode. Because of this, I never realized I had two Scripts in the same directory named “SurveyConfig.” One is an older version of the current Script…
I apologize for wasting everyone’s time who contributed to this, and I’ll be sure to verify any possible ‘double scripts’ again.