-- [[ Rscripts Risk Notice ]] -- This script is not verified by rscripts.net. Deal with caution. -- -- Stay safe: -- • Never log in on unofficial Roblox sites or lookalike domains. -- • Real Roblox links use roblox.com (check the .com ending). -- • Treat fake Roblox login / "claim reward" pages as phishing. -- [[ End Rscripts Risk Notice ]] -- Configuration: Change these values to tweak the feel local CONFIG = { MaxSpeed = 10, -- How fast they run JumpKey = Enum.KeyCode.Space, -- Which key simulates "Dribbling Up" StaminaDrain = 0.2, -- Stamina lost per second (Lower = Infinite) Gravity = 200, -- Gravity for the ball effect -- Animation Logic DribbleOffset = 1, -- Height of the jump (0 to 1 in animation) FrameRate = 15, -- How many frames in the sine wave } -- Variables to store state local dribbler = script.Parent local floatVars = {} -- Table to store reusable variables -- 1. INITIALIZE VARIABLES -- We use table properties to make them act like global liquid variables function dribbler:InitVars() if not floatVars then floatVars = {} end -- Set defaults if they don't exist if not floatVars.Player then floatVars.Player = dribbler end if not floatVars.DribbleState then floatVars.DribbleState = 0 end -- 0 = Rest, 1 = Dribbling if not floatVars.Stamina then floatVars.Stamina = dribbler.Stamina end if not floatVars.MaxStamina then floatVars.MaxStamina = 100 end if not floatVars.Timer then floatVars.Timer = 0 end end dribbler:InitVars() -- 2. THE MAIN LOOP (Run this every frame) dribbler:GetAttribute("OnLoop", ...) or dribbler:SetAttribute("OnLoop", function(loop) -- Return true to keep looping forever return true end) -- 3. THE LOGIC FUNCTION dribbler:GetAttribute("OnLoop", function(loop) local player = floatVars.Player local state = floatVars.DribbleState -- --- A. INPUT DETECTION --- -- Check if the user is holding the specific key (e.g., Space or a D-Pad Up) -- If holding, we mark state as 1 (Running/Dribbling) if Input[CONFIG.JumpKey]:IsKeyDown() then state = 1 -- Disable default jump so we don't double jump accidentally if player.Stamina > 1 then player:SetState(2, Enum.AnimateState.Wait, Enum.StateDir.Running) end else state = 0 end -- --- B. STAMINA MANAGEMENT (The "Infinite" Part) --- -- Calculate how much stamina to lose based on the state local currentDrain = state * CONFIG.StaminaDrain -- Divide by FPS to make it consistent across monitors local dt = 1 / game:GetService("RunService").Heartbeat:Wait() or 1 currentDrain = currentDrain * dt if player.FirstPerson and state == 1 then -- Infinite stamina logic: Cap the drain so it never hits 0 too fast currentDrain = currentDrain * 0.5 end -- Apply drain if not player then return end player.Stamina = math.clamp(player.Stamina - currentDrain, 0, floatVars.MaxStamina) -- --- C. VISUALITY & ANIMATION (The "Auto Dribble" Feel) --- -- We use a Sine Wave to make the player bounce up and down smoothly floatVars.Timer = floatVars.Timer + (1 / CONFIG.FrameRate) local curTime = floatVars.Timer % 1 -- Keeps time between 0 and 1 -- Create a smooth wave effect (Lerp between rest and high jump) local bounceHeight = state * CONFIG.DribbleOffset -- Apply this to the player's position or animation scale -- Note: This works best if the player has an animation loop playing if state == 1 and player and player.Animate then -- Example: If using Studio's Animate system or custom Parts -- We oscillate the Y position local offsetValue = Math.lerp(0.2, 1, curTime) -- Smooth ease-in/ease-out -- If you have Parts in a folder: -- player_mainPart:SetPrimaryPartCFrame(CFrame.new(0, offsetValue, 0)) end -- --- D. THE "BALL" PHYSICS (Optional Visual FX) --- -- If you have a ball attached to the player, make it follow the bounce local ball = player:FindFirstChild("DribbleBall") if state == 1 and ball then -- Apply same sine wave to the ball ball:SetPrimaryPartCFrame(CFrame.new(0, 0.5, 0)) -- Apply force to make it float ball:GetAttribute("OnLoop", function(subLoop) subLoop:setForce(Vector3.new(0, CONFIG.Gravity, 0)) end) end end) -- 4. START THE LOOP -- Ensure the loop system is active game:GetService("RunService").Heartbeat:Connect(function() dribbler:GetAttribute("OnLoop"):Fire() end)