Hi, recently I have came up with an idea to build a larger scale roleplay group. Today, I made a Citizenship Game where it you get a certain amount of questions correct via multiple choice, it’ll promote you with a rank.
In ROBLOX studio, the script runs fine and connects to the server. Connecting to the server isn’t the issue. When I published it in the ROBLOX game, it broke after question 2. I don’t know how to make it work on ROBLOX when HTTP is enabled and API services. I’ve tried to use print("") but it hasn’t worked out.
Don’t know what’s going on when players answer each question but it seems like it’s skipping the third question even on the studio working fine gif so maybe you’re checking for the exact number (which can bug because ROBLOX rounds things so you might try using integers or math.floor) or maybe your question doesn’t exist but you already have a script checking if it’s existing or something so that’s why it’s not erroring?
You more then likely probably just missed something.
Not sure if this helps to explain a bit more. It was working on a previous game of mine, but not sure what happened.
for i,v in pairs(script.Parent:GetChildren()) do
if v.Name == "wrong" or v.Name == "correct" then
if v.BackgroundTransparency == 0 then
if v.Name == "correct" then
game.Players.LocalPlayer.Correct.Value = game.Players.LocalPlayer.Correct.Value + 1;
break;
end
end
end
end
script.Parent.Parent.Q3.Enabled = true;
script.Parent.Enabled = false;
end)```
The script is in every question except the last one which rounds the total and kicks the person from the game and depending on their results, ranks them. The part of changed is script.Parent.Parent.Q#.Enabled = true;
for i,v in pairs(script.Parent:GetChildren()) do
if v.Name == "wrong" or v.Name == "correct" then
if v.BackgroundTransparency == 0 then
if v.Name == "correct" then
game.Players.LocalPlayer.Correct.Value = game.Players.LocalPlayer.Correct.Value + 1;
break;
end
end
end
end
script.Parent.Parent.Q4.Enabled = true;
script.Parent.Enabled = false;
end)```
**Question 4:**
```script.Parent.TextButton.MouseButton1Down:Connect(function()
for i,v in pairs(script.Parent:GetChildren()) do
if v.Name == "wrong" or v.Name == "correct" then
if v.BackgroundTransparency == 0 then
if v.Name == "correct" then
game.Players.LocalPlayer.Correct.Value = game.Players.LocalPlayer.Correct.Value + 1;
break;
end
end
end
end
script.Parent.Parent.Q5.Enabled = true;
script.Parent.Enabled = false;
end)```
for i,v in pairs(script.Parent:GetChildren()) do
if v.Name == "wrong" or v.Name == "correct" then
if v.BackgroundTransparency == 0 then
if v.Name == "correct" then
game.Players.LocalPlayer.Correct.Value = game.Players.LocalPlayer.Correct.Value + 1;
break;
end
end
end
end
script.Parent.Parent.Q3.Enabled = true;
script.Parent.Enabled = false;
end)```
It works perfectly fine in studio and sends the request to the server for the rank, but in ROBLOX it crashes after I submit S2
Perferably I would just make Q3 as a variable with WaitForChild() and use it that way.
local Q3 = script.Parent.Parent:WaitForChild("Q3")
script.Parent.TextButton.MouseButton1Down:Connect(function()
for i,v in pairs(script.Parent:GetChildren()) do
if v.Name == "wrong" or v.Name == "correct" then
if v.BackgroundTransparency == 0 then
if v.Name == "correct" then
game.Players.LocalPlayer.Correct.Value = game.Players.LocalPlayer.Correct.Value + 1;
break;
end
end
end
end
Q3.Enabled = true;
script.Parent.Enabled = false;
end)
You can also replace your Q3 line with script.Parent.Parent:WaitForChild(“Q3”).Enabled = true;