You can write your topic however you want, but you need to answer these questions:
-
What do you want to achieve? Keep it simple and clear!
i want to make a random math script and it doesn’t work like it should. -
What is the issue? Include screenshots / videos if possible!
its always marks incorrect . - What solutions have you tried so far? Did you look for solutions on the Developer Hub?
After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!
local question1 = script.Parent.TextLabel
local Box1 = script.Parent.Box1
local function randMath()
local op = math.random(1, 4)
local a = math.random(0, 14)
local b = math.random(1, 14)
if op == 1 then
question1.Text = a .. " + " .. b .. " ="
return a + b
elseif op == 2 then
question1.Text = a .. " - " .. b .. " ="
return a - b
elseif op == 3 then
question1.Text = a .. " x " .. b .. " ="
return a * b
else
question1.Text = a .. " % " .. b .. " ="
return a / b
end
end
local function AskQuestion()
local answer = randMath()
local guess = tonumber(Box1.Text)
return guess == answer
end
local correct = AskQuestion()
Box1.FocusLost:Connect(function()
if correct then
script.Parent.ImageLabel.ImageColor3 = Color3.new(0, 1, 0)
else
script.Parent.ImageLabel.ImageColor3 = Color3.new(1, 0, 0)
end
end)
Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.