-- Gamble GUI -- Author: You -- Odds: 50% -10 HP | 10% Reverse Time (10s) | 1% Blink+Noclip | 39% common tools -- Notes: -- - Grapple always restores WalkSpeed to 16 and AutoRotate true, even on cancel/death. -- - On death: GUI is removed, noclip ends, history clears. GUI rebuilds on respawn. -- - Only gambles if you're alive. local Players = game:GetService("Players") local RunService = game:GetService("RunService") local TweenService = game:GetService("TweenService") local LP = Players.LocalPlayer -- STATE ----------------------------------------------------------------------- local screen -- ScreenGui (rebuilt on respawn) local frame, result, gambleBtn local noclipConn local posHistory = {} local SAMPLE = 0.1 local MAX_TIME = 12 local maxSamples = math.floor(MAX_TIME / SAMPLE) -- UTILS ----------------------------------------------------------------------- local function getChar() return LP.Character or LP.CharacterAdded:Wait() end local function getHumPair() local c = getChar() return c:WaitForChild("Humanoid"), c:WaitForChild("HumanoidRootPart") end local function bubble(text, color) local c = getChar() local head = c:FindFirstChild("Head") or c:FindFirstChildWhichIsA("BasePart") if not head then return end local bb = Instance.new("BillboardGui") bb.Name = "GambleBubble" bb.Size = UDim2.new(0, 0, 0, 0) bb.StudsOffset = Vector3.new(0, 3, 0) bb.Adornee = head bb.Parent = head local tl = Instance.new("TextLabel") tl.Size = UDim2.new(0, 220, 0, 36) tl.BackgroundTransparency = 0.2 tl.BackgroundColor3 = Color3.fromRGB(20, 20, 20) tl.Text = text tl.Font = Enum.Font.GothamBold tl.TextSize = 16 tl.TextColor3 = color or Color3.fromRGB(255,255,255) tl.Parent = bb Instance.new("UICorner", tl).CornerRadius = UDim.new(0, 8) task.delay(1.2, function() if bb then bb:Destroy() end end) end local function startNoclip() if noclipConn then return end noclipConn = RunService.Stepped:Connect(function() local c = LP.Character if not c then return end for _,v in ipairs(c:GetDescendants()) do if v:IsA("BasePart") then v.CanCollide = false end end end) end local function stopNoclip() if noclipConn then noclipConn:Disconnect(); noclipConn = nil end end local function createHandle(color) local p = Instance.new("Part") p.Name = "Handle" p.Size = Vector3.new(1,1,1) p.Color = color or Color3.fromRGB(90,90,90) p.Anchored = false p.CanCollide = false p.Massless = true return p end local function putInBackpack(tool) tool.Parent = LP:WaitForChild("Backpack") end -- HISTORY SAMPLING ------------------------------------------------------------ local hbConn local function startSampling() if hbConn then hbConn:Disconnect() end posHistory = {} local acc = 0 hbConn = RunService.Heartbeat:Connect(function(dt) acc += dt if acc >= SAMPLE then acc -= SAMPLE local hum, hrp = getHumPair() if hum and hum.Health > 0 and hrp then table.insert(posHistory, hrp.CFrame) if #posHistory > maxSamples then table.remove(posHistory, 1) end end end end) end -- TOOLS ----------------------------------------------------------------------- -- Safe Teleport local function makeSafeTeleportTool() local tool = Instance.new("Tool") tool.Name = "Safe Teleport" tool.RequiresHandle = true createHandle(Color3.fromRGB(80, 200, 255)).Parent = tool tool.Activated:Connect(function() local hum, hrp = getHumPair() if not hum or hum.Health <= 0 then return end local best, bestDist for _, d in ipairs(workspace:GetDescendants()) do if d:IsA("SpawnLocation") then local dist = (hrp.Position - d.Position).Magnitude if not best or dist < bestDist then best, bestDist = d, dist end end end local target = best and (best.Position + Vector3.new(0, 5, 0)) or (hrp.Position + Vector3.new(0, 50, 0)) hrp.CFrame = CFrame.new(target) bubble("Teleported to safety!", Color3.fromRGB(120,220,255)) tool:Destroy() end) return tool end -- Speed Potion local function makeSpeedPotion(multiplier, durationSec, label) local tool = Instance.new("Tool") tool.Name = label or ("Speed Potion x"..tostring(multiplier)) tool.RequiresHandle = true createHandle(Color3.fromRGB(255, 80, 120)).Parent = tool tool.Activated:Connect(function() local hum = select(1, getHumPair()) if not hum or hum.Health <= 0 then return end if tool:GetAttribute("Active") then return end tool:SetAttribute("Active", true) local baseWalk = hum.WalkSpeed hum.WalkSpeed = math.max(2, baseWalk * multiplier) bubble(tool.Name.." ON ("..durationSec.."s)", Color3.fromRGB(255,120,160)) task.delay(durationSec, function() if hum and hum.Parent then hum.WalkSpeed = baseWalk bubble("Speed reverted", Color3.fromRGB(200,200,200)) end if tool and tool.Parent then tool:Destroy() end end) end) return tool end -- Jump Potion local function makeJumpPotion(multiplier, durationSec, label) local tool = Instance.new("Tool") tool.Name = label or ("Jump Potion x"..tostring(multiplier)) tool.RequiresHandle = true createHandle(Color3.fromRGB(120, 180, 255)).Parent = tool tool.Activated:Connect(function() local hum = select(1, getHumPair()) if not hum or hum.Health <= 0 then return end if tool:GetAttribute("Active") then return end tool:SetAttribute("Active", true) local usingPower = hum.UseJumpPower local basePower, baseHeight if usingPower then basePower = hum.JumpPower hum.JumpPower = math.max(10, basePower * multiplier) else baseHeight = hum.JumpHeight hum.JumpHeight = math.max(2, baseHeight * multiplier) end bubble(tool.Name.." ON ("..durationSec.."s)", Color3.fromRGB(140,200,255)) task.delay(durationSec, function() if hum and hum.Parent then if usingPower then hum.JumpPower = basePower else hum.JumpHeight = baseHeight end bubble("Jump reverted", Color3.fromRGB(200,200,200)) end if tool and tool.Parent then tool:Destroy() end end) end) return tool end -- Rope Grapple (fixed) local function makeRopeGrapple() local tool = Instance.new("Tool") tool.Name = "Rope Grapple" tool.RequiresHandle = true createHandle(Color3.fromRGB(220,220,220)).Parent = tool local actConn, uneqConn, diedConn local grappleBusy = false local function cleanupGrapple(hum, hrp, beam, attachStart, anchor) if beam then pcall(function() beam:Destroy() end) end if attachStart then pcall(function() attachStart:Destroy() end) end if anchor then pcall(function() anchor:Destroy() end) end if hum and hum.Parent then hum.WalkSpeed = 16 hum.AutoRotate = true end grappleBusy = false end tool.Equipped:Connect(function(mouse) mouse = mouse or LP:GetMouse() -- Avoid stacking Activated connections across equips if actConn then actConn:Disconnect() end actConn = tool.Activated:Connect(function() if grappleBusy then return end grappleBusy = true local hum, hrp = getHumPair() if not hum or hum.Health <= 0 then cleanupGrapple(hum, hrp); return end local hitCF = mouse and mouse.Hit if not hitCF then bubble("No target", Color3.fromRGB(255,150,150)); cleanupGrapple(hum, hrp); return end local targetPos = hitCF.Position -- Visual rope setup local attachStart = Instance.new("Attachment"); attachStart.Name = "GrappleStart"; attachStart.Parent = hrp local anchor = Instance.new("Part") anchor.Name = "GrapplePoint" anchor.Size = Vector3.new(0.2,0.2,0.2) anchor.Anchored = true; anchor.CanCollide = false; anchor.Transparency = 1 anchor.Position = targetPos; anchor.Parent = workspace local attachEnd = Instance.new("Attachment"); attachEnd.Name = "GrappleEnd"; attachEnd.Parent = anchor local beam = Instance.new("Beam") beam.Color = ColorSequence.new(Color3.fromRGB(200,200,200)) beam.Width0, beam.Width1 = 0.05, 0.05 beam.Attachment0, beam.Attachment1 = attachStart, attachEnd beam.LightEmission = 0.7 beam.Transparency = NumberSequence.new(0.1) beam.Parent = hrp -- Movement local speed = 60 local start = hrp.Position local dist = (targetPos - start).Magnitude local dur = math.clamp(dist / speed, 0.2, 3.5) local endCF = CFrame.new(targetPos + Vector3.new(0, 3, 0), targetPos) local oldRotate = hum.AutoRotate hum.AutoRotate = false hum.WalkSpeed = 0 local tween = TweenService:Create(hrp, TweenInfo.new(dur, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {CFrame = endCF}) tween:Play() -- Cancel hooks (death or unequip) local canceled = false if diedConn then diedConn:Disconnect() end local humanoid = hum diedConn = humanoid.Died:Connect(function() canceled = true pcall(function() tween:Cancel() end) end) if uneqConn then uneqConn:Disconnect() end uneqConn = tool.Unequipped:Connect(function() canceled = true pcall(function() tween:Cancel() end) end) -- Wait for tween or cancel local completed = false tween.Completed:Connect(function() completed = true end) local t0 = os.clock() while not completed and not canceled and os.clock() - t0 < dur + 0.5 do RunService.Heartbeat:Wait() end -- Cleanup (always restore to safe defaults) cleanupGrapple(hum, hrp, beam, attachStart, anchor) bubble("Grapple!", Color3.fromRGB(230,230,230)) end) end) tool.Destroying:Connect(function() if actConn then actConn:Disconnect() end if uneqConn then uneqConn:Disconnect() end if diedConn then diedConn:Disconnect() end end) return tool end -- Blink + Noclip (1%) local function makeBlinkNoclip() local tool = Instance.new("Tool") tool.Name = "Blink + Noclip (1%)" tool.RequiresHandle = true createHandle(Color3.fromRGB(255, 230, 100)).Parent = tool local cachedMouse tool.Equipped:Connect(function(mouse) cachedMouse = mouse or LP:GetMouse() end) tool.Activated:Connect(function() local hum, hrp = getHumPair() if not hum or hum.Health <= 0 then return end local mouse = cachedMouse or LP:GetMouse() local hitCF = mouse and mouse.Hit if not hitCF then bubble("No target", Color3.fromRGB(255,150,150)); return end hrp.CFrame = CFrame.new(hitCF.Position + Vector3.new(0, 3, 0)) bubble("Blink!", Color3.fromRGB(255,230,120)) startNoclip() bubble("Noclip 8s", Color3.fromRGB(255,230,120)) task.delay(8, function() stopNoclip() bubble("Noclip ended", Color3.fromRGB(200,200,200)) if tool and tool.Parent then tool:Destroy() end end) end) return tool end -- Reverse Time (10s, 10%) local function makeReverseTool() local tool = Instance.new("Tool") tool.Name = "Reverse Time (10s)" tool.RequiresHandle = true createHandle(Color3.fromRGB(120, 255, 200)).Parent = tool tool.Activated:Connect(function() if tool:GetAttribute("Used") then return end tool:SetAttribute("Used", true) local hum, hrp = getHumPair() if not hum or hum.Health <= 0 then return end local need = math.floor(10 / SAMPLE) local snaps = {} for i = #posHistory, math.max(1, #posHistory - need + 1), -1 do table.insert(snaps, posHistory[i]) end if #snaps < 3 then bubble("Not enough history", Color3.fromRGB(255,150,150)); tool:Destroy(); return end local oldWalk, oldRot = hum.WalkSpeed, hum.AutoRotate hum.WalkSpeed = 0; hum.AutoRotate = false startNoclip() bubble("Rewinding 10s...", Color3.fromRGB(120,255,200)) for i = 1, #snaps do if not hum or hum.Health <= 0 then break end hrp.CFrame = snaps[i] task.wait(SAMPLE) end stopNoclip() if hum and hum.Parent then hum.AutoRotate = true hum.WalkSpeed = oldWalk end bubble("Back to then.", Color3.fromRGB(200,200,200)) tool:Destroy() end) return tool end -- COMMON REWARD POOL ---------------------------------------------------------- local function giveCommonReward() local rewards = { function() return makeSafeTeleportTool() end, function() return makeSpeedPotion(2, 15, "Speed Potion 1 (x2, 15s)") end, function() return makeSpeedPotion(3, 15, "Speed Potion 2 (x3, 15s)") end, function() return makeJumpPotion(1.5, 15, "Jump Potion 1 (x1.5, 15s)") end, function() return makeJumpPotion(2, 15, "Jump Potion 2 (x2, 15s)") end, function() return makeRopeGrapple() end, } local pick = rewards[math.random(1, #rewards)]() putInBackpack(pick) return pick.Name end -- GUI BUILD / RESET ----------------------------------------------------------- local function destroyGui() if screen then pcall(function() screen:Destroy() end) screen = nil end frame, result, gambleBtn = nil, nil, nil end local function buildGui() destroyGui() local PG = LP:WaitForChild("PlayerGui") screen = Instance.new("ScreenGui") screen.Name = "GambleUI" screen.ResetOnSpawn = false -- we manually reset on death for instant cleanup screen.IgnoreGuiInset = false screen.Parent = PG frame = Instance.new("Frame") frame.Name = "Panel" frame.Size = UDim2.new(0, 280, 0, 170) frame.Position = UDim2.new(0, 20, 0, 80) frame.BackgroundColor3 = Color3.fromRGB(20, 20, 20) frame.BorderSizePixel = 0 frame.Active = true frame.Draggable = true frame.Parent = screen local uiCorner = Instance.new("UICorner", frame); uiCorner.CornerRadius = UDim.new(0, 10) local uiStroke = Instance.new("UIStroke", frame); uiStroke.Thickness = 2; uiStroke.Color = Color3.fromRGB(255, 70, 70) local title = Instance.new("TextLabel") title.BackgroundTransparency = 1 title.Size = UDim2.new(1, -10, 0, 34) title.Position = UDim2.new(0, 10, 0, 8) title.Text = "Gamble" title.Font = Enum.Font.GothamBold title.TextSize = 20 title.TextColor3 = Color3.fromRGB(255,255,255) title.TextXAlignment = Enum.TextXAlignment.Left title.Parent = frame result = Instance.new("TextLabel") result.BackgroundTransparency = 1 result.Size = UDim2.new(1, -20, 0, 40) result.Position = UDim2.new(0, 10, 0, 46) result.Text = "Tap GAMBLE. Alive-only. Death resets UI." result.Font = Enum.Font.Gotham result.TextSize = 16 result.TextColor3 = Color3.fromRGB(220,220,220) result.TextWrapped = true result.Parent = frame gambleBtn = Instance.new("TextButton") gambleBtn.Size = UDim2.new(1, -20, 0, 56) gambleBtn.Position = UDim2.new(0, 10, 1, -66) gambleBtn.BackgroundColor3 = Color3.fromRGB(255, 70, 70) gambleBtn.Text = "GAMBLE" gambleBtn.Font = Enum.Font.GothamBlack gambleBtn.TextSize = 22 gambleBtn.TextColor3 = Color3.fromRGB(255,255,255) gambleBtn.AutoButtonColor = true gambleBtn.Parent = frame Instance.new("UICorner", gambleBtn).CornerRadius = UDim.new(0, 10) end local function setBtnState(enabled) if not gambleBtn then return end gambleBtn.AutoButtonColor = enabled gambleBtn.BackgroundColor3 = enabled and Color3.fromRGB(255, 70, 70) or Color3.fromRGB(120, 120, 120) gambleBtn.Active = enabled end -- GAMBLE LOGIC ---------------------------------------------------------------- local cooldown = false local function doRoll() if cooldown then return end local hum = select(1, getHumPair()) if not hum or hum.Health <= 0 then if result then result.Text = "You must be alive to gamble." result.TextColor3 = Color3.fromRGB(255,150,150) end return end cooldown = true setBtnState(false) if result then result.Text = "Rolling..." result.TextColor3 = Color3.fromRGB(240,240,240) end task.wait(0.35) local roll = math.random(1, 100) if roll <= 50 then hum:TakeDamage(10) if result then result.Text = "-10 HP (Ouch!)" result.TextColor3 = Color3.fromRGB(255,120,120) end bubble("-10 HP", Color3.fromRGB(255,90,90)) elseif roll <= 60 then local t = makeReverseTool() putInBackpack(t) if result then result.Text = "You won: Reverse Time (10s)" result.TextColor3 = Color3.fromRGB(120,255,200) end bubble("Won: Reverse Time", Color3.fromRGB(120,255,200)) elseif roll <= 61 then local t = makeBlinkNoclip() putInBackpack(t) if result then result.Text = "You won: Blink + Noclip (1%)" result.TextColor3 = Color3.fromRGB(255,230,120) end bubble("Legendary: Blink + Noclip!", Color3.fromRGB(255,230,120)) else local name = giveCommonReward() if result then result.Text = "You won: "..name result.TextColor3 = Color3.fromRGB(120,255,160) end bubble("Won: "..name, Color3.fromRGB(120,255,160)) end task.delay(0.6, function() cooldown = false setBtnState(true) end) end -- WIRING ---------------------------------------------------------------------- local clickConn, nudgeConn local function hookButton() if not gambleBtn then return end if clickConn then clickConn:Disconnect() end clickConn = gambleBtn.MouseButton1Click:Connect(doRoll) if nudgeConn then nudgeConn:Disconnect() end nudgeConn = gambleBtn.MouseButton1Down:Connect(function() local p0 = gambleBtn.Position TweenService:Create(gambleBtn, TweenInfo.new(0.05), {Position = p0 + UDim2.new(0, 2, 0, 0)}):Play() task.wait(0.05) TweenService:Create(gambleBtn, TweenInfo.new(0.05), {Position = p0}):Play() end) end local diedConn, addedConn local function onCharacter(char) -- Ensure defaults on spawn task.defer(function() local hum = char:WaitForChild("Humanoid") hum.WalkSpeed = 16 hum.AutoRotate = true end) -- Start history sampling fresh startSampling() -- Rebuild GUI and hook buildGui() hookButton() -- Death handling: hard reset if diedConn then diedConn:Disconnect() end local hum = char:WaitForChild("Humanoid") diedConn = hum.Died:Connect(function() stopNoclip() posHistory = {} destroyGui() -- remove immediately on death end) end -- INIT ------------------------------------------------------------------------ if addedConn then addedConn:Disconnect() end addedConn = LP.CharacterAdded:Connect(onCharacter) if LP.Character then onCharacter(LP.Character) end