local Players = game:GetService("Players") local ContentProvider = game:GetService("ContentProvider") local RunService = game:GetService("RunService") local UserInputService = game:GetService("UserInputService") local HttpService = game:GetService("HttpService") local Player = Players.LocalPlayer local PlayerGui = Player:WaitForChild("PlayerGui") local TextureId = "12890944256" local MusicUrl = "https://raw.githubusercontent.com/9faces/gang-maxwell/main/maxwell.mp3" local MusicFile = "music.mp3" local PositionFile = "maxwell_position.json" local Columns = 4 local Rows = 4 local TotalFrames = 16 local FPS = 15 local SpriteSize = 147 local Dragging = false local DragInput = nil local DragStart = nil local StartPosition = nil local function GetSavedPosition() local SavedData = nil local ReadFile = readfile local IsFile = isfile if type(ReadFile) == "function" then local HasFile = true if type(IsFile) == "function" then local CheckSuccess, FileExists = pcall(IsFile, PositionFile) HasFile = CheckSuccess and FileExists == true end if HasFile then local ReadSuccess, FileContents = pcall(ReadFile, PositionFile) if ReadSuccess and type(FileContents) == "string" then local DecodeSuccess, DecodedData = pcall(function() return HttpService:JSONDecode(FileContents) end) if DecodeSuccess and type(DecodedData) == "table" then SavedData = DecodedData end end end end if not SavedData and type(getgenv) == "function" then local EnvironmentSuccess, Environment = pcall(getgenv) if EnvironmentSuccess and type(Environment) == "table" then local EnvironmentPosition = Environment.MaxwellSavedPosition if type(EnvironmentPosition) == "table" then SavedData = EnvironmentPosition end end end if type(SavedData) ~= "table" then return nil end local XScale = SavedData.XScale local XOffset = SavedData.XOffset local YScale = SavedData.YScale local YOffset = SavedData.YOffset if type(XScale) ~= "number" or type(XOffset) ~= "number" or type(YScale) ~= "number" or type(YOffset) ~= "number" then return nil end if XScale ~= XScale or XOffset ~= XOffset or YScale ~= YScale or YOffset ~= YOffset then return nil end return UDim2.new(XScale, XOffset, YScale, YOffset) end local OldGui = PlayerGui:FindFirstChild("Maxwell") if OldGui then OldGui:Destroy() end local ScreenGui = Instance.new("ScreenGui") ScreenGui.Name = "Maxwell" ScreenGui.ResetOnSpawn = false ScreenGui.IgnoreGuiInset = true ScreenGui.DisplayOrder = 1000000 ScreenGui.ZIndexBehavior = Enum.ZIndexBehavior.Sibling ScreenGui.Parent = PlayerGui local SpriteViewport = Instance.new("Frame") SpriteViewport.Name = "Viewport" SpriteViewport.AnchorPoint = Vector2.new(0.5, 0.5) SpriteViewport.Position = GetSavedPosition() or UDim2.fromScale(0.5, 0.5) SpriteViewport.Size = UDim2.fromOffset(SpriteSize, SpriteSize) SpriteViewport.BackgroundTransparency = 1 SpriteViewport.BorderSizePixel = 0 SpriteViewport.ClipsDescendants = true SpriteViewport.Active = true SpriteViewport.Parent = ScreenGui local MaxwelledSprite = Instance.new("ImageLabel") MaxwelledSprite.Name = "Sprite" MaxwelledSprite.BackgroundTransparency = 1 MaxwelledSprite.BorderSizePixel = 0 MaxwelledSprite.Position = UDim2.fromOffset(0, 0) MaxwelledSprite.Size = UDim2.fromOffset(SpriteSize * Columns, SpriteSize * Rows) MaxwelledSprite.Image = "rbxassetid://" .. TextureId MaxwelledSprite.ImageRectSize = Vector2.zero MaxwelledSprite.ImageRectOffset = Vector2.zero MaxwelledSprite.ScaleType = Enum.ScaleType.Stretch MaxwelledSprite.ImageTransparency = 0 MaxwelledSprite.ImageColor3 = Color3.new(1, 1, 1) MaxwelledSprite.Active = true MaxwelledSprite.Parent = SpriteViewport local function SavePosition() local CurrentPosition = SpriteViewport.Position local SavedData = { XScale = CurrentPosition.X.Scale, XOffset = CurrentPosition.X.Offset, YScale = CurrentPosition.Y.Scale, YOffset = CurrentPosition.Y.Offset } if type(getgenv) == "function" then local EnvironmentSuccess, Environment = pcall(getgenv) if EnvironmentSuccess and type(Environment) == "table" then Environment.MaxwellSavedPosition = SavedData end end if type(writefile) == "function" then local EncodeSuccess, EncodedData = pcall(function() return HttpService:JSONEncode(SavedData) end) if EncodeSuccess then pcall(writefile, PositionFile, EncodedData) end end end local function SetSpriteFrame(FrameNumber) local FrameIndex = (FrameNumber - 1) % TotalFrames local Column = FrameIndex % Columns local Row = math.floor(FrameIndex / Columns) MaxwelledSprite.Position = UDim2.fromOffset(-Column * SpriteSize, -Row * SpriteSize) end local function BeginDrag(Input) if Input.UserInputType == Enum.UserInputType.MouseButton1 or Input.UserInputType == Enum.UserInputType.Touch then Dragging = true DragStart = Input.Position StartPosition = SpriteViewport.Position end end local function TrackDragInput(Input) if Input.UserInputType == Enum.UserInputType.MouseMovement or Input.UserInputType == Enum.UserInputType.Touch then DragInput = Input end end SpriteViewport.InputBegan:Connect(BeginDrag) MaxwelledSprite.InputBegan:Connect(BeginDrag) SpriteViewport.InputChanged:Connect(TrackDragInput) MaxwelledSprite.InputChanged:Connect(TrackDragInput) UserInputService.InputChanged:Connect(function(Input) if Dragging and Input == DragInput then local Delta = Input.Position - DragStart SpriteViewport.Position = UDim2.new( StartPosition.X.Scale, StartPosition.X.Offset + Delta.X, StartPosition.Y.Scale, StartPosition.Y.Offset + Delta.Y ) end end) UserInputService.InputEnded:Connect(function(Input) if Dragging and (Input.UserInputType == Enum.UserInputType.MouseButton1 or Input.UserInputType == Enum.UserInputType.Touch) then Dragging = false DragInput = nil SavePosition() end end) ScreenGui.Destroying:Connect(SavePosition) SetSpriteFrame(1) task.spawn(function() local FrameAccumulator = 0 local FrameDuration = 1 / FPS local CurrentFrame = 1 while ScreenGui.Parent and SpriteViewport.Parent and MaxwelledSprite.Parent do FrameAccumulator += RunService.RenderStepped:Wait() while FrameAccumulator >= FrameDuration do FrameAccumulator -= FrameDuration CurrentFrame = (CurrentFrame % TotalFrames) + 1 SetSpriteFrame(CurrentFrame) end end end) local Music = Instance.new("Sound") Music.Name = "MT" Music.Volume = 3 Music.Looped = true Music.Parent = ScreenGui task.spawn(function() local GetAsset = getsynasset or getcustomasset local WriteFile = writefile local IsFile = isfile if type(GetAsset) ~= "function" or type(WriteFile) ~= "function" then return end local HasFile = false if type(IsFile) == "function" then local CheckSuccess, FileExists = pcall(IsFile, MusicFile) HasFile = CheckSuccess and FileExists == true end if not HasFile then local DownloadSuccess, Data = pcall(function() return game:HttpGet(MusicUrl) end) if not DownloadSuccess or type(Data) ~= "string" or #Data == 0 then return end local SaveSuccess = pcall(WriteFile, MusicFile, Data) if not SaveSuccess then return end end local AssetSuccess, Asset = pcall(GetAsset, MusicFile) if not AssetSuccess or type(Asset) ~= "string" or Asset == "" or not ScreenGui.Parent then return end Music.SoundId = Asset pcall(function() ContentProvider:PreloadAsync({Music}) end) if ScreenGui.Parent then pcall(function() Music:Play() end) end end)