Загрузка данных


local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local TeleportService = game:GetService("TeleportService")
local UserInputService = game:GetService("UserInputService")
local LocalPlayer = Players.LocalPlayer

local gui = Instance.new("ScreenGui")
gui.Name = "DataRollback"
gui.ResetOnSpawn = false
gui.IgnoreGuiInset = true
gui.ZIndexBehavior = Enum.ZIndexBehavior.Sibling
gui.Parent = LocalPlayer.PlayerGui

local btn = Instance.new("TextButton")
btn.Size = UDim2.fromOffset(140, 40)
btn.Position = UDim2.new(0.5, -70, 0.5, -20)
btn.BackgroundColor3 = Color3.fromRGB(30, 30, 30)
btn.TextColor3 = Color3.fromRGB(255, 255, 255)
btn.Text = "Roll Back Data"
btn.TextSize = 14
btn.Font = Enum.Font.GothamBold
btn.BackgroundTransparency = 0.1
btn.BorderSizePixel = 0
btn.ZIndex = 10
btn.Parent = gui

Instance.new("UICorner", btn).CornerRadius = UDim.new(0, 8)

local stroke = Instance.new("UIStroke")
stroke.Color = Color3.fromRGB(80, 80, 80)
stroke.Thickness = 1
stroke.Parent = btn

local armed = false
local armedTime = 0

local function doRollback()
    btn.Text = "Rolling back..."
    btn.BackgroundColor3 = Color3.fromRGB(60, 60, 60)
    stroke.Color = Color3.fromRGB(80, 80, 80)

    local okPath, remote = pcall(function()
        return ReplicatedStorage.Packages._Index["sleitnick_knit@1.7.0"]
            .knit.Services.SettingsService.RF.UpdateKeybind
    end)
    if not okPath or not remote then
        btn.Text = "Failed: Remote not found"
        task.wait(2)
        btn.Text = "Roll Back Data"
        btn.BackgroundColor3 = Color3.fromRGB(30, 30, 30)
        return
    end

    local sent = pcall(function()
        remote:InvokeServer("MouseButton1", true, "Spike\xE2\x80\x8B\x8F")
    end)
    if not sent then
        btn.Text = "Failed: Invoke error"
        task.wait(2)
        btn.Text = "Roll Back Data"
        btn.BackgroundColor3 = Color3.fromRGB(30, 30, 30)
        return
    end

    btn.Text = "Teleporting..."
    pcall(function()
        TeleportService:Teleport(game.PlaceId)
    end)
end

btn.MouseButton1Click:Connect(function()
    if armed then
        armed = false
        task.spawn(doRollback)
    else
        armed = true
        armedTime = tick()
        btn.Text = "Confirm?"
        btn.BackgroundColor3 = Color3.fromRGB(160, 30, 30)
        stroke.Color = Color3.fromRGB(200, 60, 60)
    end
end)

task.spawn(function()
    while true do
        task.wait(0.5)
        if armed and tick() - armedTime > 3 then
            armed = false
            btn.Text = "Roll Back Data"
            btn.BackgroundColor3 = Color3.fromRGB(30, 30, 30)
            stroke.Color = Color3.fromRGB(80, 80, 80)
        end
    end
end)

-- drag support
local dragging, dragInput, dragStart, startPos
btn.InputBegan:Connect(function(input)
    if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then
        dragging = true
        dragStart = input.Position
        startPos = btn.Position
    end
end)
btn.InputEnded:Connect(function(input)
    if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then
        dragging = false
    end
end)
UserInputService.InputChanged:Connect(function(input)
    if dragging and (input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch) then
        local delta = input.Position - dragStart
        btn.Position = UDim2.new(startPos.X.Scale, startPos.X.Offset + delta.X, startPos.Y.Scale, startPos.Y.Offset + delta.Y)
    end
end)