Back to Scripts
chest opener
ScriptBlox
Free
Game: [📘] Strongest Mage
243
Views
1
Likes
0
Dislikes

Lamiia
offline
Features
auto open chest
chest name list:Wood1~3,Stone1~3,Magic1~3,Ancient1~3,Supreme1
Tags
Script Code
local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local TweenService = game:GetService("TweenService")
local player = Players.LocalPlayer
local playerGui = player:WaitForChild("PlayerGui")
-- Remote
local RemoteEvent = ReplicatedStorage:WaitForChild("RemoteEvent")
-- Create main screen GUI
local screenGui = Instance.new("ScreenGui")
screenGui.Name = "AutoFarmUI"
screenGui.Parent = playerGui
-- Create main frame
local mainFrame = Instance.new("Frame")
mainFrame.Name = "MainFrame"
mainFrame.Size = UDim2.new(0, 300, 0, 200)
mainFrame.Position = UDim2.new(0.5, -150, 0.5, -100)
mainFrame.AnchorPoint = Vector2.new(0.5, 0.5)
mainFrame.BackgroundColor3 = Color3.fromRGB(40, 40, 40)
mainFrame.BorderSizePixel = 0
mainFrame.ClipsDescendants = true
mainFrame.Parent = screenGui
-- Add rounded corners
local corner = Instance.new("UICorner")
corner.CornerRadius = UDim.new(0, 8)
corner.Parent = mainFrame
-- Add shadow
local shadow = Instance.new("UIStroke")
shadow.Color = Color3.fromRGB(20, 20, 20)
shadow.Thickness = 2
shadow.Parent = mainFrame
-- Title bar
local titleBar = Instance.new("Frame")
titleBar.Name = "TitleBar"
titleBar.Size = UDim2.new(1, 0, 0, 30)
titleBar.BackgroundColor3 = Color3.fromRGB(30, 30, 30)
titleBar.BorderSizePixel = 0
titleBar.Parent = mainFrame
local titleCorner = Instance.new("UICorner")
titleCorner.CornerRadius = UDim.new(0, 8)
titleCorner.Parent = titleBar
local titleLabel = Instance.new("TextLabel")
titleLabel.Name = "TitleLabel"
titleLabel.Size = UDim2.new(1, -40, 1, 0)
titleLabel.Position = UDim2.new(0, 10, 0, 0)
titleLabel.BackgroundTransparency = 1
titleLabel.Text = "Auto Chest Opener"
titleLabel.TextColor3 = Color3.fromRGB(255, 255, 255)
titleLabel.TextXAlignment = Enum.TextXAlignment.Left
titleLabel.Font = Enum.Font.GothamSemibold
titleLabel.TextSize = 14
titleLabel.Parent = titleBar
-- Close button - Fixed alignment
local closeButton = Instance.new("TextButton")
closeButton.Name = "CloseButton"
closeButton.Size = UDim2.new(0, 20, 0, 20)
closeButton.Position = UDim2.new(1, -25, 0.5, -10)
closeButton.AnchorPoint = Vector2.new(0, 0.5)
closeButton.BackgroundColor3 = Color3.fromRGB(220, 60, 60)
closeButton.BorderSizePixel = 0
closeButton.Text = "×"
closeButton.TextColor3 = Color3.fromRGB(255, 255, 255)
closeButton.TextSize = 18
closeButton.Font = Enum.Font.GothamBold
closeButton.Parent = titleBar
local closeCorner = Instance.new("UICorner")
closeCorner.CornerRadius = UDim.new(0, 4)
closeCorner.Parent = closeButton
-- Content area
local contentFrame = Instance.new("Frame")
contentFrame.Name = "ContentFrame"
contentFrame.Size = UDim2.new(1, -20, 1, -50)
contentFrame.Position = UDim2.new(0, 10, 0, 40)
contentFrame.BackgroundTransparency = 1
contentFrame.Parent = mainFrame
-- Chest type input
local chestTypeLabel = Instance.new("TextLabel")
chestTypeLabel.Name = "ChestTypeLabel"
chestTypeLabel.Size = UDim2.new(1, 0, 0, 20)
chestTypeLabel.Position = UDim2.new(0, 0, 0, 0)
chestTypeLabel.BackgroundTransparency = 1
chestTypeLabel.Text = "Chest Type:"
chestTypeLabel.TextColor3 = Color3.fromRGB(200, 200, 200)
chestTypeLabel.TextXAlignment = Enum.TextXAlignment.Left
chestTypeLabel.Font = Enum.Font.Gotham
chestTypeLabel.TextSize = 12
chestTypeLabel.Parent = contentFrame
local chestTypeBox = Instance.new("TextBox")
chestTypeBox.Name = "ChestTypeBox"
chestTypeBox.Size = UDim2.new(1, 0, 0, 30)
chestTypeBox.Position = UDim2.new(0, 0, 0, 25)
chestTypeBox.BackgroundColor3 = Color3.fromRGB(60, 60, 60)
chestTypeBox.BorderSizePixel = 0
chestTypeBox.Text = "Stone2"
chestTypeBox.TextColor3 = Color3.fromRGB(255, 255, 255)
chestTypeBox.PlaceholderText = "Enter chest type..."
chestTypeBox.Font = Enum.Font.Gotham
chestTypeBox.TextSize = 14
chestTypeBox.ClearTextOnFocus = false
chestTypeBox.Parent = contentFrame
local textBoxCorner = Instance.new("UICorner")
textBoxCorner.CornerRadius = UDim.new(0, 4)
textBoxCorner.Parent = chestTypeBox
local textBoxPadding = Instance.new("UIPadding")
textBoxPadding.PaddingLeft = UDim.new(0, 8)
textBoxPadding.PaddingRight = UDim.new(0, 8)
textBoxPadding.Parent = chestTypeBox
-- Control button
local toggleButton = Instance.new("TextButton")
toggleButton.Name = "ToggleButton"
toggleButton.Size = UDim2.new(1, 0, 0, 40)
toggleButton.Position = UDim2.new(0, 0, 0, 70)
toggleButton.BackgroundColor3 = Color3.fromRGB(80, 120, 200)
toggleButton.BorderSizePixel = 0
toggleButton.Text = "START LOOP"
toggleButton.TextColor3 = Color3.fromRGB(255, 255, 255)
toggleButton.Font = Enum.Font.GothamSemibold
toggleButton.TextSize = 14
toggleButton.Parent = contentFrame
local buttonCorner = Instance.new("UICorner")
buttonCorner.CornerRadius = UDim.new(0, 6)
buttonCorner.Parent = toggleButton
-- Status label
local statusLabel = Instance.new("TextLabel")
statusLabel.Name = "StatusLabel"
statusLabel.Size = UDim2.new(1, 0, 0, 20)
statusLabel.Position = UDim2.new(0, 0, 0, 120)
statusLabel.BackgroundTransparency = 1
statusLabel.Text = "Status: Inactive"
statusLabel.TextColor3 = Color3.fromRGB(150, 150, 150)
statusLabel.TextXAlignment = Enum.TextXAlignment.Left
statusLabel.Font = Enum.Font.Gotham
statusLabel.TextSize = 12
statusLabel.Parent = contentFrame
-- Variables
local isRunning = false
local loopConnection = nil
-- Close button function
closeButton.MouseButton1Click:Connect(function()
screenGui:Destroy()
end)
-- Close button hover effects
closeButton.MouseEnter:Connect(function()
closeButton.BackgroundColor3 = Color3.fromRGB(200, 50, 50)
end)
closeButton.MouseLeave:Connect(function()
closeButton.BackgroundColor3 = Color3.fromRGB(220, 60, 60)
end)
-- Text box focus effects
chestTypeBox.Focused:Connect(function()
chestTypeBox.BackgroundColor3 = Color3.fromRGB(70, 70, 70)
end)
chestTypeBox.FocusLost:Connect(function()
chestTypeBox.BackgroundColor3 = Color3.fromRGB(60, 60, 60)
end)
-- Toggle button function
toggleButton.MouseButton1Click:Connect(function()
if isRunning then
-- Stop loop
if loopConnection then
loopConnection:Disconnect()
loopConnection = nil
end
isRunning = false
toggleButton.Text = "START LOOP"
toggleButton.BackgroundColor3 = Color3.fromRGB(80, 120, 200)
statusLabel.Text = "Status: Stopped"
statusLabel.TextColor3 = Color3.fromRGB(150, 150, 150)
else
-- Start loop
local chestType = chestTypeBox.Text
if chestType == "" then
chestType = "Stone2"
chestTypeBox.Text = chestType
end
isRunning = true
toggleButton.Text = "STOP LOOP"
toggleButton.BackgroundColor3 = Color3.fromRGB(200, 80, 80)
statusLabel.Text = "Status: Running - " .. chestType
statusLabel.TextColor3 = Color3.fromRGB(100, 255, 100)
-- Create loop
loopConnection = game:GetService("RunService").Heartbeat:Connect(function()
RemoteEvent:FireServer("OpenAllChest", chestType)
end)
end
end)
-- Toggle button hover effects
toggleButton.MouseEnter:Connect(function()
if isRunning then
toggleButton.BackgroundColor3 = Color3.fromRGB(180, 70, 70)
else
toggleButton.BackgroundColor3 = Color3.fromRGB(70, 100, 180)
end
end)
toggleButton.MouseLeave:Connect(function()
if isRunning then
toggleButton.BackgroundColor3 = Color3.fromRGB(200, 80, 80)
else
toggleButton.BackgroundColor3 = Color3.fromRGB(80, 120, 200)
end
end)
-- Draggable functionality
local dragging = false
local dragInput, dragStart, startPos
local function update(input)
local delta = input.Position - dragStart
mainFrame.Position = UDim2.new(startPos.X.Scale, startPos.X.Offset + delta.X, startPos.Y.Scale, startPos.Y.Offset + delta.Y)
end
titleBar.InputBegan:Connect(function(input)
if input.UserInputType == Enum.UserInputType.MouseButton1 then
dragging = true
dragStart = input.Position
startPos = mainFrame.Position
input.Changed:Connect(function()
if input.UserInputState == Enum.UserInputState.End then
dragging = false
end
end)
end
end)
titleBar.InputChanged:Connect(function(input)
if input.UserInputType == Enum.UserInputType.MouseMovement and dragging then
dragInput = input
end
end)
game:GetService("UserInputService").InputChanged:Connect(function(input)
if input == dragInput and dragging then
update(input)
end
end)
Comments (0)
Please login to comment
Login with Discord
Loading comments...