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 would like to use brackets (also known as “()”) in the same way as math.
- What is the issue? Include screenshots / videos if possible!
When a number is placed next to a bracket, the invisible multiplication sign is not accounted for and the code errors.
- What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I tried to put brackets around the whole thing but it did not work and I could not find any 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 Event = game:GetService("ReplicatedStorage").Events.CalculateEquation
Event.OnServerEvent:Connect(function(player, text, X) -- assume text is "1(X)"
text = string.gsub(text, "X", tostring(X or 0))
text = "return ("..text..")"
print(text)
local CalculationFunction, errorMessage = loadstring(text)
print(errorMessage) -- [string "return (1(1))"]:1: Expected ')' (to close '(' at column 8), got '('
CalculationFunction()
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.