You can write your topic however you want, but you need to answer these questions:
- What do you want to achieve? My entire Table to send 100% of the time.
- What is the issue? My Function will sometimes send a shortened version of my full Table, rather than the full thing. It only happens about 40% of the time, so it’s random.
- What solutions have you tried so far? A lot.
This error occurs about 40-50% of the time when starting my Game.
When the issue does occur, the Table equals:
04:57:51.611 ▼ {
["Question"] = "How much do you enjoy the Gameplay?",
["ResponseType"] = "Rate"
} - Client - SurveyHandler:38
When the issue doesn’t occur, the Table equals:
05:00:29.937 ▼ {
["ID"] = 1,
["Question"] = "How much do you enjoy the Gameplay?",
["ResponseType"] = "Rate",
["Survey"] = 1
} - Client - SurveyHandler:38
So the overall issue is that sometimes the Table is only sent with 2 Values rather than all 4.
Ok, so in my StarterGUI I have a LocalScript, which pulls from a ModuleScript in my ReplicatedStorage.
The ModuleScript in my ReplicatedStorage is meant to be a Config File where I store my Survey Setup, here are a few members of the Table within the file:
local Configuration = {
{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"},
}
(SurveyConfig Module Script in ReplicatedStorage)
My LocalScript in the StarterGUI requires the SurveyConfig. It uses this, loops through the Table, and each time sends the Config line to a ModuleScript located in the same directory as the LocalScript (StarterGUI).
local surveyConfig = require(ReplicatedStorage:WaitForChild("Scripts"):WaitForChild("Config"):WaitForChild("SurveyConfig"))
local surveyManager = require(script.Parent:WaitForChild("SurveyManager"))
local storedSurvey = 0
for _, configLine in ipairs(surveyConfig) do
if storedSurvey ~= configLine.Survey then
print(configLine)
local surveyTemplate = surveyManager.newSurvey(configLine)
end
end
(SurveyHandler Local Script in StarterGUI)
My ModuleScript in the same directory as the LocalScript will run the function called.
function Survey.newSurvey(config)
print(config)
print(config.Survey)
end
(SurveyManager Module Script in StarterGUI)