local Players = game:GetService("Players") local LP = Players.LocalPlayer local Workspace = game:GetService("Workspace") -- ======================================================= -- ⚙️ CONFIGURATION -- ======================================================= local ITEM_NAME_TO_COLLECT = "Tix" local MAX_DISTANCE = 5000 local DATA_KEY = "TotalTixCollected" -- ======================================================= -- 🎯 UTILITY & DATA FUNCTIONS -- ======================================================= local function GetRoot() local Char = LP.Character if Char and Char.Parent then return Char:FindFirstChild("HumanoidRootPart") end return LP.CharacterAdded:Wait():FindFirstChild("HumanoidRootPart") end local function LoadTotalTix() local success, data = pcall(function() return LP:LoadData(DATA_KEY) end) if success and type(data) == "number" then return data end return 0 end local function SaveTotalTix(newTotal) local success, err = pcall(function() LP:SaveData(DATA_KEY, newTotal) end) if not success then warn("Tix Collector: Failed to save data! Error: " .. tostring(err)) end end -- ======================================================= -- 🚀 TIX COLLECTION FUNCTION (Runs Automatically) -- ======================================================= local function CollectTix() local HR = GetRoot() if not HR then print("Tix Collector: HumanoidRootPart not found. Cannot collect.") return end local collectedThisRun = 0 local targetPosition = HR.CFrame.Position + Vector3.new(0, 3, 0) for _, part in ipairs(Workspace:GetDescendants()) do if part:IsA("BasePart") and part.Name == ITEM_NAME_TO_COLLECT then local distance = (part.Position - HR.Position).Magnitude if distance <= MAX_DISTANCE and part.Parent ~= LP.Character then if part.Anchored == true then part.Anchored = false end part.CFrame = CFrame.new(targetPosition) collectedThisRun = collectedThisRun + 1 end end end local currentTotal = LoadTotalTix() local newTotal = currentTotal + collectedThisRun if collectedThisRun > 0 then SaveTotalTix(newTotal) print(string.format("✅ Tix Collector: Collected %d Tix this run.", collectedThisRun)) else print("Tix Collector: Found no Tix within the specified range this run.") end print(string.format("💰 TOTAL TIX COLLECTED (Persistent): %d", newTotal)) end -- ======================================================= -- 💀 RESET FUNCTION -- ======================================================= local function ResetCharacter() -- This method forces the character to die and respawn. local Humanoid = LP.Character and LP.Character:FindFirstChildOfClass("Humanoid") if Humanoid then Humanoid.Health = 0 print("💀 Character Reset Initiated.") else print("Character Reset Failed: Humanoid not found.") end end -- ======================================================= -- 🖼️ GUI CONSTRUCTION (Simple Button) -- ======================================================= local function CreateResetGUI() local Gui = Instance.new("ScreenGui") Gui.Name = "ResetControl" Gui.ResetOnSpawn = false Gui.Parent = LP:FindFirstChild("PlayerGui") or LP.PlayerGui local Button = Instance.new("TextButton") Button.Name = "ResetButton" Button.Size = UDim2.new(0, 100, 0, 40) Button.Position = UDim2.fromScale(0.95, 0.95) -- Bottom right corner Button.AnchorPoint = Vector2.new(1, 1) Button.Text = "RESET CHARACTER" Button.Font = Enum.Font.SourceSansBold Button.TextSize = 14 Button.TextColor3 = Color3.fromRGB(255, 255, 255) Button.BackgroundColor3 = Color3.fromRGB(200, 50, 50) -- Red color Button.BorderSizePixel = 0 Instance.new("UICorner", Button).CornerRadius = UDim.new(0, 5) Button.MouseButton1Click:Connect(ResetCharacter) Button.Parent = Gui end -- ======================================================= -- ⚙️ EXECUTION -- ======================================================= -- 1. Run Tix Collection immediately CollectTix() -- 2. Create the Reset Button CreateResetGUI()