working calculator
Key RequiredUniversal

working calculator

Universal ScriptGuest_7293Guest_7293 396 views 365 executesUpdated Mar 8, 2026
Unrated
00
Lua Script•189 lines (5307 chars)
local player = game.Players.LocalPlayer

-- GUI
local screenGui = Instance.new("ScreenGui")
screenGui.Name = "AdvancedCalculator"
screenGui.ResetOnSpawn = false
screenGui.Parent = player:WaitForChild("PlayerGui")

-- =========================
-- PANTALLA DE CARGA
-- =========================

local loadingFrame = Instance.new("Frame")
loadingFrame.Size = UDim2.new(1,0,1,0)
loadingFrame.BackgroundColor3 = Color3.fromRGB(15,15,15)
loadingFrame.Parent = screenGui
loadingFrame.ZIndex = 10

local loadingText = Instance.new("TextLabel")
loadingText.Size = UDim2.new(1,0,0,60)
loadingText.Position = UDim2.new(0,0,0.5,-30)
loadingText.BackgroundTransparency = 1
loadingText.TextColor3 = Color3.new(1,1,1)
loadingText.TextScaled = true
loadingText.Text = "Fast, Easy, Accurate"
loadingText.Parent = loadingFrame
-- =====================
-- LOADING ANIMATION
-- =====================
local TweenService = game:GetService("TweenService")

task.spawn(function()
	local fadeOutText = TweenService:Create(
		loadingText,
		TweenInfo.new(0.8, Enum.EasingStyle.Sine, Enum.EasingDirection.InOut),
		{TextTransparency = 0.6}
	)
	local fadeInText = TweenService:Create(
		loadingText,
		TweenInfo.new(0.8, Enum.EasingStyle.Sine, Enum.EasingDirection.InOut),
		{TextTransparency = 0}
	)
	for i = 1,3 do
		fadeOutText:Play()
		fadeOutText.Completed:Wait()
		fadeInText:Play()
		fadeInText.Completed:Wait()
	end
	local finalTextFade = TweenService:Create(
		loadingText,
		TweenInfo.new(0.6, Enum.EasingStyle.Sine, Enum.EasingDirection.InOut),
		{TextTransparency = 1}
	)
	local finalBgFade = TweenService:Create(
		loadingFrame,
		TweenInfo.new(0.8, Enum.EasingStyle.Sine, Enum.EasingDirection.InOut),
		{BackgroundTransparency = 1}
	)
	finalTextFade:Play()
	finalBgFade:Play()
	finalBgFade.Completed:Wait()
	loadingFrame:Destroy()
end)

task.wait(2)

-- =========================
-- CALCULATOR
-- =========================

local frame = Instance.new("Frame")
frame.Size = UDim2.new(0.35,0,0.6,0)
frame.Position = UDim2.new(0.325,0,0.2,0)
frame.BackgroundColor3 = Color3.fromRGB(25,25,25)
frame.Parent = screenGui
frame.ZIndex = 1
local corner = Instance.new("UICorner")
corner.CornerRadius = UDim.new(0,20)
corner.Parent = frame
local topBar = Instance.new("Frame")
topBar.Size = UDim2.new(1,0,0,40)
topBar.BackgroundColor3 = Color3.fromRGB(35,35,35)
topBar.Parent = frame
local topCorner = Instance.new("UICorner")
topCorner.CornerRadius = UDim.new(0,20)
topCorner.Parent = topBar
local dragging = false
local dragStart
local startPos
topBar.InputBegan:Connect(function(input)
	if input.UserInputType == Enum.UserInputType.MouseButton1 
	or input.UserInputType == Enum.UserInputType.Touch then	
		dragging = true
		dragStart = input.Position
		startPos = frame.Position	
		input.Changed:Connect(function()
			if input.UserInputState == Enum.UserInputState.End then
				dragging = false
			end
		end)
	end
end)
topBar.InputChanged:Connect(function(input)
	if dragging and (input.UserInputType == Enum.UserInputType.MouseMovement 
	or input.UserInputType == Enum.UserInputType.Touch) then	
		local delta = input.Position - dragStart
		frame.Position = UDim2.new(
			startPos.X.Scale,
			startPos.X.Offset + delta.X,
			startPos.Y.Scale,
			startPos.Y.Offset + delta.Y
		)
	end
end)
local display = Instance.new("TextLabel")
display.Size = UDim2.new(1,-20,0,60)
display.Position = UDim2.new(0,10,0,50)
display.BackgroundColor3 = Color3.fromRGB(45,45,45)
display.TextColor3 = Color3.new(1,1,1)
display.TextScaled = true
display.TextXAlignment = Enum.TextXAlignment.Right
display.Text = ""
display.Parent = frame
local displayCorner = Instance.new("UICorner")
displayCorner.CornerRadius = UDim.new(0,15)
displayCorner.Parent = display
local function evaluateExpression(expr)
	expr = expr:gsub("×","*")
	expr = expr:gsub("÷","/")
	local success, result = pcall(function()
		return loadstring("return " .. expr)()
	end)
	if success then
		return tostring(result)
	else
		return "Error"
	end
end
local function createButton(text, row, col)
	local button = Instance.new("TextButton")
	button.Size = UDim2.new(0.22,0,0.12,0)
	button.Position = UDim2.new(0.04 + (col*0.24),0,0.32 + (row*0.14),0)
	button.BackgroundColor3 = Color3.fromRGB(60,60,60)
	button.TextColor3 = Color3.new(1,1,1)
	button.TextScaled = true
	button.Text = text
	button.Parent = frame
	local c = Instance.new("UICorner")
	c.CornerRadius = UDim.new(0,12)
	c.Parent = button
	button.MouseButton1Click:Connect(function()
		if text == "=" then
			display.Text = evaluateExpression(display.Text)
		elseif text == "C" then
			display.Text = ""
		else
			display.Text = display.Text .. text
		end
	end)
end
local buttons = {
	{"7","8","9","÷"},
	{"4","5","6","×"},
	{"1","2","3","-"},
	{"0","C","=","+"}
}
for r,row in ipairs(buttons) do
	for c,value in ipairs(row) do
		createButton(value, r-1, c-1)
	end
end

-- useless thing

local StarterGui = game:GetService("StarterGui")
local function SendCustomNotification(title, text, duration, icon)
	StarterGui:SetCore("SendNotification", {
		Title = title or "Notification",
		Text = text or "Hello world!",
		Duration = duration or 5,
		Icon = icon or "" -- Puedes poner un asset id aquí
	})
end
SendCustomNotification(
	"thx for using Guest's and ChatGPT's calculator",
	"F.E.A.C.S",
	6,
	"rbxassetid://6031075938"
)

Features & Information

makes a working calculator
#calculator

Community Comments (0)

No comments yet for this script.

More Scripts for Universal Scripts