-- Volley Bomb | Ball Trajectory Script - by Fyye_Hub local Workspace = game:GetService("Workspace") local RunService = game:GetService("RunService") local Players = game:GetService("Players") local LP = Players.LocalPlayer local SKINS = { ["Ice Ball"]=true, ["Galaxy Ball"]=true, ["Beach Ball"]=true, ["Volleyball"]=true, ["Basketball"]=true, ["Evidence Ball"]=true, ["Football"]=true, ["Bowling Ball"]=true, ["Redacted Ball"]=true, ["Smokescreen Ball"]=true, ["Target Ball"]=true, ["Aurora Ball"]=true, ["Deadeye Ball"]=true, ["Golden Ball"]=true, ["Laserline Ball"]=true, ["Volcanic Ball"]=true, ["Afterimage Ball"]=true, ["Cannonball"]=true, ["Dragon Ball"]=true, ["Operative Ball"]=true, ["Circuit Rush"]=true, ["Imperial Weave"]=true, ["Prism Strike"]=true, ["Redline Core Ball"]=true, ["Tidal Crest"]=true, ["Default"]=true, ["Ball"]=true } local BALL_RADIUS = 1.5 local MARKER_DIAMETER = 3.6 local MARKER_THICK = 0.16 local WALL_RESTITUTION = 0.82 local MOVE_EPS = 0.012 local TELEPORT_JUMP = 50 local BOUNCE_VY = 3.2 local STICK_STUDS = 2.0 local RAY_REFRESH = 12 local MIN_SPEED = 0.6 local DESCEND_VY = -0.5 local LERP_SPEED = 12 local STEP_DT = 1/140 local MAX_STEPS = 520 local MAX_BOUNCES = 4 local folder = Instance.new("Folder") folder.Name = tostring(math.random(100000, 999999)) folder.Parent = Workspace local ballData = {} local rayParams = RaycastParams.new() rayParams.FilterType = Enum.RaycastFilterType.Exclude rayParams.RespectCanCollide = true local rayTick = 0 local function refreshRayIgnore() local ignore = {folder} for _, c in ipairs(Workspace:GetChildren()) do if c.Name == "BallShadow" or (SKINS[c.Name] and (c:IsA("BasePart") or c:IsA("MeshPart"))) then table.insert(ignore, c) end end for _, pl in ipairs(Players:GetPlayers()) do if pl.Character then table.insert(ignore, pl.Character) end end rayParams.FilterDescendantsInstances = ignore end refreshRayIgnore() local function isBall(o) if not o or not o.Parent then return false end if o.Name == "BallShadow" then return false end if o.Parent ~= Workspace then return false end return SKINS[o.Name] and (o:IsA("BasePart") or o:IsA("MeshPart")) end local function createMarker() local p = Instance.new("Part") p.Name = "x"..math.random(10000, 99999) p.Shape = Enum.PartType.Cylinder p.Size = Vector3.new(MARKER_THICK, MARKER_DIAMETER, MARKER_DIAMETER) p.Color = Color3.fromRGB(255, 25, 25) p.Material = Enum.Material.Neon p.Anchored = true p.CanCollide = false p.CanQuery = false p.CanTouch = false p.CastShadow = false p.Transparency = 1 p.Parent = folder return p end local function getData(ball) if not ballData[ball] then ballData[ball] = { marker = createMarker(), history = {}, lastLanding = nil, displayed = nil, locked = nil, lockUntil = 0 } end return ballData[ball] end local function destroyData(ball) local d = ballData[ball] if d then if d.marker then d.marker:Destroy() end ballData[ball] = nil end end local function getGroundY(atXZ) local origin = Vector3.new(atXZ.X, 220, atXZ.Z) local hit = Workspace:Raycast(origin, Vector3.new(0, -450, 0), rayParams) if hit then return hit.Position.Y + BALL_RADIUS end local char = LP.Character if char then local hrp = char:FindFirstChild("HumanoidRootPart") local hum = char:FindFirstChildOfClass("Humanoid") if hrp then local hip = hum and hum.HipHeight or 2 return (hrp.Position.Y - 0.5*hrp.Size.Y - hip) + BALL_RADIUS end end return 29 end local function pushSample(d, ball) local now = tick() local pos = ball.Position local hist = d.history local n = #hist if n > 0 then local last = hist[n] local dp = (pos - last.p).Magnitude if dp < MOVE_EPS and (now - last.t) < 0.07 then return end if dp > TELEPORT_JUMP then d.history = {} d.lastLanding = nil d.displayed = nil d.locked = nil d.lockUntil = 0 return end end if n >= 3 then local a, b, c = hist[n-2], hist[n-1], hist[n] local dt1 = b.t - a.t local dt2 = c.t - b.t if dt1 > 1e-5 and dt2 > 1e-5 then local vy1 = (b.p.Y - a.p.Y) / dt1 local vy2 = (c.p.Y - b.p.Y) / dt2 if vy1 < -BOUNCE_VY and vy2 > BOUNCE_VY then d.history = {c} d.lastLanding = nil d.displayed = nil d.locked = nil d.lockUntil = 0 end end end table.insert(hist, {t = now, p = pos}) while #hist > 1 and now - hist[1].t > 0.22 do table.remove(hist, 1) end while #hist > 16 do table.remove(hist, 1) end end local function getVelocity(d, ball) local av = ball.AssemblyLinearVelocity if av and av.Magnitude > 0.15 then return av end local hist = d.history local n = #hist if n < 2 then return nil end local use = math.min(n, 3) local start = n - use + 1 local tM = 0 for i = start, n do tM = tM + hist[i].t end tM = tM / use local sx, sy, sz, stt = 0, 0, 0, 0 for i = start, n do local dt = hist[i].t - tM sx = sx + dt * hist[i].p.X sy = sy + dt * hist[i].p.Y sz = sz + dt * hist[i].p.Z stt = stt + dt * dt end if stt < 1e-8 then return nil end return Vector3.new(sx/stt, sy/stt, sz/stt) end local function reflect(vel, normal) return vel - 2 * vel:Dot(normal) * normal end local function simulateLanding(startPos, startVel) local g = Workspace.Gravity local p = startPos local v = startVel local bounces = 0 local groundY = getGroundY(startPos) for i = 1, MAX_STEPS do local nextV = v + Vector3.new(0, -g, 0) * STEP_DT local nextP = p + v * STEP_DT + Vector3.new(0, -0.5 * g * STEP_DT * STEP_DT, 0) local delta = nextP - p if delta.Magnitude > 0.04 then local hit = Workspace:Raycast(p, delta, rayParams) if hit then local n = hit.Normal if math.abs(n.Y) < 0.7 then if bounces >= MAX_BOUNCES then local land = hit.Position + n * 1.4 return Vector3.new(land.X, getGroundY(land), land.Z) end p = hit.Position + n * 0.15 v = reflect(v, n) * WALL_RESTITUTION bounces = bounces + 1 elseif n.Y > 0.55 then return Vector3.new(hit.Position.X, hit.Position.Y + BALL_RADIUS, hit.Position.Z) else local land = hit.Position + n * 1.2 return Vector3.new(land.X, getGroundY(land), land.Z) end else p = nextP v = nextV end else p = nextP v = nextV end if p.Y <= groundY + 0.2 and v.Y < DESCEND_VY then return Vector3.new(p.X, groundY, p.Z) end end return Vector3.new(p.X, getGroundY(p), p.Z) end local function updateBall(ball, dt) local d = getData(ball) pushSample(d, ball) local vel = getVelocity(d, ball) if not vel or vel.Magnitude < MIN_SPEED then d.marker.Transparency = 1 return end local landing = simulateLanding(ball.Position, vel) if not landing then d.marker.Transparency = 1 return end local now = tick() if d.locked and now < d.lockUntil then if (landing - d.locked).Magnitude < STICK_STUDS * 1.5 then landing = d.locked else d.locked = landing d.lockUntil = now + 0.14 end else if d.lastLanding and (landing - d.lastLanding).Magnitude < STICK_STUDS then landing = d.lastLanding d.locked = landing d.lockUntil = now + 0.16 else d.locked = landing d.lockUntil = now + 0.09 end end d.lastLanding = landing if not d.displayed then d.displayed = landing else d.displayed = d.displayed:Lerp(landing, math.clamp(LERP_SPEED * dt, 0, 1)) end d.marker.CFrame = CFrame.new(d.displayed) * CFrame.Angles(0, 0, math.rad(90)) d.marker.Transparency = 0.32 end RunService.Heartbeat:Connect(function(dt) rayTick = rayTick + 1 if rayTick >= RAY_REFRESH then refreshRayIgnore(); rayTick = 0 end local alive = {} for _, c in ipairs(Workspace:GetChildren()) do if isBall(c) then alive[c] = true updateBall(c, dt) end end for ball in pairs(ballData) do if not alive[ball] or not ball.Parent then destroyData(ball) end end end) Workspace.ChildAdded:Connect(function(o) task.defer(function() if isBall(o) then refreshRayIgnore() end end) end)