Movement Prediction
Key Required

Movement Prediction

[🎪] Knockout! 🐧IscriptForfunIscriptForfun 2.4K views 6 executesUpdated Feb 19, 2026
5.0/ 5(1 votes)
10100% Positive
Lua Script•157 lines (4466 chars)
local Players = game:GetService("Players")
local RunService = game:GetService("RunService")
local UserInputService = game:GetService("UserInputService")

local player = Players.LocalPlayer
local camera = workspace.CurrentCamera
local character = player.Character or player.CharacterAdded:Wait()
local hrp = character:WaitForChild("HumanoidRootPart")

-- =========================
-- CONFIG
-- =========================
local level = 3
local minLevel, maxLevel = 1, 10
local baseSpeed = 7.84
local speedStep = 2.85
local friction = 6.3

-- =========================
-- STATE
-- =========================
local currentLine
local currentSphere
local isMoving = false
local lastPosition = hrp.Position
local wasMoving = false -- track movement transition

-- =========================
-- GUI
-- =========================
local screenGui = Instance.new("ScreenGui")
screenGui.Name = "DynamicSlidePredictor"
screenGui.ResetOnSpawn = false
screenGui.Parent = player:WaitForChild("PlayerGui")

local textLabel = Instance.new("TextLabel")
textLabel.Size = UDim2.new(0, 240, 0, 55)
textLabel.Position = UDim2.new(1, -250, 0, 20)
textLabel.BackgroundColor3 = Color3.fromRGB(15, 15, 15)
textLabel.BackgroundTransparency = 0.2
textLabel.TextColor3 = Color3.fromRGB(0, 170, 255)
textLabel.Font = Enum.Font.SourceSansBold
textLabel.TextScaled = true
textLabel.Parent = screenGui

-- =========================
-- UTILS
-- =========================
local function getSpeed()
	return baseSpeed + (level - 1) * speedStep
end

local function calculateDistance(speed)
	return (speed * speed) / (2 * friction)
end

local function createPredictionLine(startPos, endPos)
	if currentLine then currentLine:Destroy() end
	if currentSphere then currentSphere:Destroy() end

	-- Line
	local line = Instance.new("Part")
	line.Anchored = true
	line.CanCollide = false
	line.Transparency = 0.35
	line.Material = Enum.Material.Neon
	line.Color = Color3.fromRGB(0, 120, 255)
	local distance = (endPos - startPos).Magnitude
	line.Size = Vector3.new(0.35, 0.35, distance)
	line.CFrame = CFrame.new(startPos, endPos) * CFrame.new(0,0,-distance/2)
	line.Parent = workspace
	currentLine = line

	-- Sphere
	local sphere = Instance.new("Part")
	sphere.Shape = Enum.PartType.Ball
	sphere.Anchored = true
	sphere.CanCollide = false
	sphere.Transparency = 0.25
	sphere.Material = Enum.Material.Neon
	sphere.Color = Color3.fromRGB(0, 120, 255)
	sphere.Size = Vector3.new(3,3,3)
	sphere.Position = endPos
	sphere.Parent = workspace
	currentSphere = sphere
end

local function updateGUI(dist, mode)
	textLabel.Text = string.format("Level: %d/10\nDistance: %.1f\nMode: %s", level, dist, mode)
end

local function predictSlide(currentSpeed, direction)
	local dist = calculateDistance(currentSpeed)
	return hrp.Position + Vector3.new(direction.X, 0, direction.Z).Unit * dist
end

-- =========================
-- MAIN LOOP
-- =========================
RunService.RenderStepped:Connect(function(dt)
	if not hrp or not camera then return end

	-- Calculate speed
	local currentSpeed = (hrp.Position - lastPosition).Magnitude / dt
	local moving = currentSpeed > 0.1
	lastPosition = hrp.Position

	-- detect movement transition
	if wasMoving and not moving then
		-- just stopped moving → reset level to 3
		level = 3
	end
	wasMoving = moving

	isMoving = moving

	if moving then
		-- moving: predict based on velocity
		local direction = hrp.AssemblyLinearVelocity
		if direction.Magnitude < 0.1 then direction = camera.CFrame.LookVector end
		local endPos = predictSlide(direction.Magnitude, direction)
		createPredictionLine(hrp.Position, endPos)
		updateGUI((endPos - hrp.Position).Magnitude, "Predicting")
	else
		-- stationary: live update with camera rotation
		local lookDir = camera.CFrame.LookVector
		local endPos = predictSlide(getSpeed(), lookDir)
		createPredictionLine(hrp.Position, endPos)
		updateGUI((endPos - hrp.Position).Magnitude, "Live")
	end
end)

-- =========================
-- INPUT
-- =========================
UserInputService.InputBegan:Connect(function(input, gp)
	if gp then return end

	if input.KeyCode == Enum.KeyCode.E then
		if level < maxLevel then
			level += 1
		end
	elseif input.KeyCode == Enum.KeyCode.Q then
		if level > minLevel then
			level -= 1
		end
	end
end)

-- =========================
-- RESPAWN
-- =========================
player.CharacterAdded:Connect(function(char)
	character = char
	hrp = char:WaitForChild("HumanoidRootPart")
	lastPosition = hrp.Position
end)

Features & Information

accurately predicts your stopping point in game. DOES NOT WORK ON MOBILE, USES Q AND E INPUT

Community Comments (3)

zaxitsgoodzaxitsgoodFeb 19, 2026(edited)

What this even do?

YYZZZ777YYZZZ777Feb 19, 2026

are u slow

YYZZZ777YYZZZ777Feb 19, 2026

it predicts where u will stop

More Scripts for [🎪] Knockout! 🐧