local Screen = workspace.Map.Functional.Screen local QuestionText = Screen.SurfaceGui.MainFrame.MainGameContainer.MainTxtContainer.QuestionText local TypingText = Screen.SurfaceGui.MainFrame.MainGameContainer.MainTxtContainer.TypingText local Fill = Screen.SurfaceGui.MainFrame.MainGameContainer.TimerbarContainer.Fill local ReplicatedStorage = game:GetService("ReplicatedStorage") local TextChatService = game:GetService("TextChatService") local Players = game:GetService("Players") local CurrentSpeller = ReplicatedStorage.GameValues.CurrentSpeller local ClickSound = ReplicatedStorage.Assets.SFX.Click local GameEvent = ReplicatedStorage.Events.GameEvent local Player = Players.LocalPlayer local function SetTyping(text) ClickSound:Play() TypingText.Text = text GameEvent:FireServer("updateAnswer", text) end if script_connections then for _, Connection in ipairs(script_connections) do Connection:Disconnect() end table.clear(script_connections) end local Connections = {} getgenv().script_connections = Connections table.insert(Connections, Fill:GetPropertyChangedSignal("Size"):Connect(function() if Fill:GetAttribute("Answer") then if Fill.Size.X.Scale <= Fill:GetAttribute("UhunAnswer") and not Fill:GetAttribute("TweenEnabled") then Fill:SetAttribute("TweenEnabled", true) if TextChatService.ChatVersion == Enum.ChatVersion.LegacyChatService then -- ReplicatedStorage.DefaultChatSystemChatEvents.SayMessageRequest:FireServer(Fill:GetAttribute("Answer"), "All") else -- TextChatService.TextChannels.RBXGeneral:SendAsync(Fill:GetAttribute("Answer")) end elseif Fill.Size.X.Scale >= Fill:GetAttribute("UhunAnswer") then Fill:SetAttribute("TweenEnabled", nil) end end end)) table.insert(Connections, QuestionText:GetPropertyChangedSignal("Text"):Connect(function() local Character = Player.Character or Player.CharacterAdded:Wait() local question = string.split(QuestionText.Text, "=")[1] local result = tostring(loadstring("return " .. string.gsub(question, "x", "*"))()) Fill:SetAttribute("Answer", math.random(1, 2) == 1 and result) Fill:SetAttribute("UhunAnswer", math.random(3, 6) / 10) if CurrentSpeller.Value ~= Player then return nil end task.wait(math.random(3, 8) / 10) if tonumber(result) >= 15 then task.wait(math.random(5, 10) / 10) end while TypingText.Text ~= result do if #TypingText.Text >= #result then local length = string.sub(TypingText.Text, 1, #result) ~= result and 1 or #result while #TypingText.Text >= length do SetTyping(string.sub(TypingText.Text, 1, #TypingText.Text - 1)) task.wait(0.05) end end local typingSpeed = math.random(2, 6) / 10 if math.random(1, 4) == 4 and #TypingText.Text > 0 and Fill.Size.X.Scale >= 0.3 then SetTyping(TypingText.Text .. tostring(math.random(0, 9))) task.wait(math.random(2, 5) / 10) SetTyping(string.sub(TypingText.Text, 1, #TypingText.Text - 1)) task.wait(math.random(1, 3) / 10) end SetTyping(string.sub(result, 1, #TypingText.Text + 1)) local speedMultiplier = math.clamp(Fill.Size.X.Scale, 0.25, 1) task.wait(typingSpeed * speedMultiplier) if math.random(1, 5) == 5 and Fill.Size.X.Scale >= 0.25 then task.wait(math.random(3, 7) / 10) end end GameEvent:FireServer("submitAnswer", result) end))