local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Players = game:GetService("Players")
local UserInputService = game:GetService("UserInputService")
local TweenService = game:GetService("TweenService")
local LocalPlayer = Players.LocalPlayer
local PlayerGui = LocalPlayer:WaitForChild("PlayerGui")
local questionText = workspace.Map.Functional.Screen.SurfaceGui.MainFrame.MainGameContainer.MainTxtContainer.QuestionText
local GameEvent = ReplicatedStorage.Events.GameEvent
local gsub = string.gsub
local lastAnsweredQuestion = ""
local isMinimized = false
local ScreenGui = Instance.new("ScreenGui")
ScreenGui.Name = "NebulaHub"
ScreenGui.ResetOnSpawn = false
ScreenGui.ZIndexBehavior = Enum.ZIndexBehavior.Sibling
ScreenGui.Parent = PlayerGui
local MainFrame = Instance.new("Frame")
MainFrame.Name = "MainFrame"
MainFrame.Size = UDim2.new(0, 300, 0, 150)
MainFrame.Position = UDim2.new(0.5, -150, 0.4, -75)
MainFrame.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
MainFrame.BorderSizePixel = 0
MainFrame.Parent = ScreenGui
local UICorner = Instance.new("UICorner")
UICorner.CornerRadius = UDim.new(0, 12)
UICorner.Parent = MainFrame
local UIGradient = Instance.new("UIGradient")
UIGradient.Color = ColorSequence.new({
ColorSequenceKeypoint.new(0, Color3.fromRGB(180, 20, 40)),
ColorSequenceKeypoint.new(0.5, Color3.fromRGB(110, 20, 120)),
ColorSequenceKeypoint.new(1, Color3.fromRGB(40, 10, 90))
})
UIGradient.Rotation = 45
UIGradient.Parent = MainFrame
local UIStroke = Instance.new("UIStroke")
UIStroke.Thickness = 2
UIStroke.Color = Color3.fromRGB(230, 80, 255)
UIStroke.Transparency = 0.3
UIStroke.Parent = MainFrame
local Title = Instance.new("TextLabel")
Title.Name = "Title"
Title.Size = UDim2.new(1, 0, 0, 40)
Title.Position = UDim2.new(0, 0, 0, 0)
Title.BackgroundTransparency = 1
Title.Text = "🔮 nebula hub" -- Updated to crystal ball emoji!
Title.TextColor3 = Color3.fromRGB(255, 255, 255)
Title.TextSize = 20
Title.Font = Enum.Font.GothamBold
Title.TextXAlignment = Enum.TextXAlignment.Center
Title.Parent = MainFrame
local Divider = Instance.new("Frame")
Divider.Name = "Divider"
Divider.Size = UDim2.new(0.9, 0, 0, 2)
Divider.Position = UDim2.new(0.05, 0, 0, 40)
Divider.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
Divider.BackgroundTransparency = 0.6
Divider.BorderSizePixel = 0
Divider.Parent = MainFrame
local StatusLabel = Instance.new("TextLabel")
StatusLabel.Name = "StatusLabel"
StatusLabel.Size = UDim2.new(0.9, 0, 0, 80)
StatusLabel.Position = UDim2.new(0.05, 0, 0, 50)
StatusLabel.BackgroundTransparency = 1
StatusLabel.Text = "Waiting for a question..."
StatusLabel.TextColor3 = Color3.fromRGB(240, 240, 240)
StatusLabel.TextSize = 15
StatusLabel.Font = Enum.Font.GothamMedium
StatusLabel.TextWrapped = true
StatusLabel.TextXAlignment = Enum.TextXAlignment.Center
StatusLabel.TextYAlignment = Enum.TextYAlignment.Center
StatusLabel.Parent = MainFrame
local MinimizeBtn = Instance.new("TextButton")
MinimizeBtn.Name = "MinimizeBtn"
MinimizeBtn.Size = UDim2.new(0, 24, 0, 24)
MinimizeBtn.Position = UDim2.new(1, -34, 0, 8)
MinimizeBtn.BackgroundTransparency = 1
MinimizeBtn.Text = "—"
MinimizeBtn.TextColor3 = Color3.fromRGB(255, 255, 255)
MinimizeBtn.TextSize = 14
MinimizeBtn.Font = Enum.Font.GothamBold
MinimizeBtn.Parent = MainFrame
local LogoIcon = Instance.new("TextButton")
LogoIcon.Name = "LogoIcon"
LogoIcon.Size = UDim2.new(0, 55, 0, 55)
LogoIcon.Position = UDim2.new(0.05, 0, 0.4, 0)
LogoIcon.BackgroundColor3 = Color3.fromRGB(80, 15, 90)
LogoIcon.Visible = false
LogoIcon.Text = "🔮"
LogoIcon.TextSize = 28
LogoIcon.Parent = ScreenGui
local LogoCorner = Instance.new("UICorner")
LogoCorner.CornerRadius = UDim.new(1, 0)
LogoCorner.Parent = LogoIcon
local LogoStroke = Instance.new("UIStroke")
LogoStroke.Thickness = 2
LogoStroke.Color = Color3.fromRGB(230, 80, 255)
LogoStroke.Transparency = 0.2
LogoStroke.Parent = LogoIcon
local function toggleGui()
isMinimized = not isMinimized
if isMinimized then
MainFrame.Visible = false
LogoIcon.Visible = true
else
MainFrame.Visible = true
LogoIcon.Visible = false
end
end
MinimizeBtn.MouseButton1Click:Connect(toggleGui)
LogoIcon.MouseButton1Click:Connect(toggleGui)
local function setupDrag(guiElement)
local dragging = false
local dragInput
local dragStart
local startPos
local function update(input)
local delta = input.Position - dragStart
guiElement.Position = UDim2.new(startPos.X.Scale, startPos.X.Offset + delta.X, startPos.Y.Scale, startPos.Y.Offset + delta.Y)
end
guiElement.InputBegan:Connect(function(input)
if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then
dragging = true
dragStart = input.Position
startPos = guiElement.Position
input.Changed:Connect(function()
if input.UserInputState == Enum.UserInputState.End then
dragging = false
end
end)
end
end)
guiElement.InputChanged:Connect(function(input)
if input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch then
dragInput = input
end
end)
UserInputService.InputChanged:Connect(function(input)
if input == dragInput and dragging then
update(input)
end
end)
end
setupDrag(MainFrame)
setupDrag(LogoIcon)
local function fireUpdateAnswerSequence(answer)
local answerStr = tostring(answer)
for i = 1, #answerStr do
local partialAnswer = string.sub(answerStr, 1, i)
local args = {
[1] = "updateAnswer",
[2] = partialAnswer
}
GameEvent:FireServer(unpack(args))
task.wait(0.1)
end
end
local function safeEval(str)
str = gsub(str, "%s+", "")
local left, op, right = string.match(str, "^([%-%d%.]+)([%+%-%*/])([%-%d%.]+)$")
if left and op and right then
local num1 = tonumber(left)
local num2 = tonumber(right)
if op == "+" then return num1 + num2 end
if op == "-" then return num1 - num2 end
if op == "*" then return num1 * num2 end
if op == "/" then return num2 ~= 0 and num1 / num2 or nil end
end
return nil
end
questionText:GetPropertyChangedSignal("Text"):Connect(function()
local expression = questionText.Text
if expression == "" or expression:find("=.+%d") or expression == lastAnsweredQuestion then
return
end
local originalQuestion = expression
local evalExpression = expression
evalExpression = gsub(evalExpression, "=.*$", "")
evalExpression = gsub(evalExpression, "x", "*")
StatusLabel.Text = "Solving: " .. evalExpression
StatusLabel.TextColor3 = Color3.fromRGB(255, 230, 100)
local success, result = pcall(function()
return safeEval(evalExpression)
end)
if success and result then
lastAnsweredQuestion = originalQuestion
StatusLabel.Text = "✅ Solved!\n" .. evalExpression .. " = " .. tostring(result)
StatusLabel.TextColor3 = Color3.fromRGB(150, 255, 150)
fireUpdateAnswerSequence(result)
else
StatusLabel.Text = "❌ Failed to parse:\n" .. tostring(evalExpression)
StatusLabel.TextColor3 = Color3.fromRGB(255, 150, 150)
end
end)
Comments
No comments yet
Be the first to share your thoughts!