Advertisement
kipr987

Matimatika

Feb 18th, 2025 (edited)
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.60 KB | None | 0 0
  1. if game:GetService("CoreGui"):FindFirstChild("Mat") then
  2.     game:GetService("CoreGui"):FindFirstChild("Mat"):Destroy()
  3. end
  4. local function create()
  5.     gui = Instance.new("ScreenGui",game:GetService("CoreGui"))
  6.     gui.Name = "Mat"
  7.  
  8.     t = Instance.new("TextLabel",gui)
  9.  
  10.     t.Position = UDim2.new(0.886, 0,0.81, 0)
  11.     t.Size = UDim2.new(0.057, 0,0.112, 0)
  12.     t.TextScaled = true
  13.     t.TextColor3 = Color3.new(1, 1, 1)
  14.     t.BackgroundTransparency = 1
  15.  
  16.     local ui = Instance.new("UIAspectRatioConstraint",t)
  17. end
  18. create()
  19. while wait(.3) do
  20.     if not game:GetService("CoreGui"):FindFirstChild("Mat") and not game:GetService("CoreGui"):FindFirstChild("Mat"):FindFirstChild("TextLabel") then
  21.         create()
  22.     end
  23.     local expression = workspace.Map.Functional.Screen.SurfaceGui.MainFrame.MainGameContainer.MainTxtContainer.QuestionText.Text
  24.     expression = string.gsub(expression, "%s+", "")
  25.     expression = string.gsub(expression, "%s+", "=")
  26.     expression = string.gsub(expression, "x", "*")
  27.     local function performOperation(operand1, operand2, operator)
  28.         operand1 = tonumber(operand1)
  29.         operand2 = tonumber(operand2)
  30.         if operator == "+" then
  31.             return operand1 + operand2
  32.         elseif operator == "-" then
  33.             return operand1 - operand2
  34.         elseif operator == "*" then
  35.             return operand1 * operand2
  36.         elseif operator == "/" then
  37.             if operand2 == 0 then
  38.                 return 0
  39.             end
  40.             return operand1 / operand2
  41.         else
  42.             return nil
  43.         end
  44.     end
  45.     local operand1, operator, operand2 = string.match(expression, "([%d%.]+)([%+%-%*/])([%d%.]+)")
  46.  
  47.     local res = performOperation(operand1,operand2,operator)
  48.     pcall(function()
  49.         t.Text = res
  50.     end)
  51. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement