--!strict local Players = game:GetService("Players") local ReplicatedStorage = game:GetService("ReplicatedStorage") local RunService = game:GetService("RunService") local Mobility = require(ReplicatedStorage:WaitForChild("ArenaMobility") :: ModuleScript) local Modes = require(ReplicatedStorage:WaitForChild("ArenaModes") :: ModuleScript) local MobilityScreen = require(ReplicatedStorage:WaitForChild("ArenaMobilityScreen") :: ModuleScript) local effects = require(ReplicatedStorage:WaitForChild("SniperEffects") :: ModuleScript) local player = Players.LocalPlayer local screen = MobilityScreen.new(player:WaitForChild("PlayerGui") :: PlayerGui) local viewmodel = player:WaitForChild("PlayerScripts"):WaitForChild("SniperViewmodel") local round = ReplicatedStorage:WaitForChild("ArenaRound") local hopUsed = round:WaitForChild("JumpRuneUsed") :: RemoteEvent type Group = {model: Model, offset: CFrame, motion: string, sequence: number, strokes: {BasePart}} type Rune = { origin: BasePart, mode: string, kind: string, phase: number, groups: {Group}, halfLength: number, light: PointLight?, sparks: ParticleEmitter?, ring: Group?, lastPulse: number, localPulse: number, } type Wave = {model: Model, strokes: {BasePart}, pose: CFrame, startedAt: number} local visibleRunes: {[Model]: Rune} = {} local jumps: {[Model]: Rune} = {} local waves: {Wave} = {} local visualEffects = Instance.new("Folder") visualEffects.Name = "LocalRuneEffects" visualEffects.Parent = workspace local boostPink = Color3.fromRGB(255, 55, 168) local boostCoral = Color3.fromRGB(255, 129, 123) local boostGold = Color3.fromRGB(255, 231, 112) local function strokesOf(model: Model): {BasePart} local strokes = {} for _, child in model:GetChildren() do if child:IsA("BasePart") then table.insert(strokes, child) end end return strokes end local function register(model: Instance, mode: string) if not model:IsA("Model") then return end local origin = model.PrimaryPart local kind = model:GetAttribute("Kind") if not origin or typeof(kind) ~= "string" then return end local groups: {Group} = {} local ring: Group? = nil for _, child in model:GetChildren() do if not child:IsA("Model") then continue end local motion = child:GetAttribute("Motion") if typeof(motion) ~= "string" then continue end local group = { model = child, offset = origin.CFrame:ToObjectSpace(child:GetPivot()), motion = motion, sequence = (child:GetAttribute("Sequence") :: number?) or 0, strokes = strokesOf(child), } table.insert(groups, group) if motion == "OuterRing" then ring = group end end local sparks = origin:FindFirstChild("RuneSparks", true) local rune: Rune = { origin = origin, mode = mode, kind = kind, phase = (model:GetAttribute("Phase") :: number?) or 0, groups = groups, halfLength = (model:GetAttribute("HalfLength") :: number?) or 0, light = origin:FindFirstChildOfClass("PointLight"), sparks = if sparks and sparks:IsA("ParticleEmitter") then sparks else nil, ring = ring, lastPulse = 0, localPulse = 0, } visibleRunes[model] = rune if kind == "Jump" then jumps[model] = rune end end local function flash(rune: Rune, now: number) local isJump = rune.kind == "Jump" if rune.sparks then rune.sparks:Emit(if isJump then 30 else 19) end local ring = rune.ring if not ring then return end local wave = ring.model:Clone() wave.Name = "RuneWave" wave.Parent = visualEffects local pose = ring.model:GetPivot() + Vector3.yAxis * .12 table.insert(waves, {model = wave, strokes = strokesOf(wave), pose = pose, startedAt = now}) end local function animate(rune: Rune, now: number, pulse: number) local phase = now + rune.phase if rune.light then rune.light.Brightness = .65 + math.sin(phase * 3) * .19 + pulse * 2.1 end local frame = rune.origin.CFrame -- Leave space for the tips and tails of the chevrons at each end of the ramp strip. local travel = rune.halfLength * 1.7 for _, group in rune.groups do local pose = frame * group.offset local motion = group.motion local transparency if motion == "BoostChase" and travel > 0 then local initialZ = group.offset.Position.Z local progress = (phase * 12 / travel + .5 - initialZ / (rune.halfLength * 2)) % 1 group.model:PivotTo(pose + frame.LookVector * ((progress - .5) * travel + initialZ)) local edge = math.clamp(math.min(progress, 1 - progress) / .12, 0, 1) local fade = edge * edge * (3 - 2 * edge) transparency = 1 - (.84 + pulse * .14) * fade local tint = if progress < .5 then boostPink:Lerp(boostCoral, progress * 2) else boostCoral:Lerp(boostGold, progress * 2 - 1) for _, stroke in group.strokes do stroke.Color = tint end elseif motion == "Chase" then local sweep = (phase * 1.05 - (group.sequence - 1) * .22) % 1 local glow = (0.5 + 0.5 * math.cos(sweep * 2 * math.pi)) ^ 4 transparency = .57 - .52 * math.max(glow, pulse) elseif motion == "Lift" then local rise = (phase * .75 + group.sequence * .5) % 1 group.model:PivotTo(pose + Vector3.yAxis * (rise * .9)) transparency = .76 - .70 * math.sin(rise * math.pi) else local spin = if motion == "OuterRing" then .72 else -.94 group.model:PivotTo(pose * CFrame.Angles(0, (phase * spin) % (2 * math.pi), 0)) transparency = math.max(.04, .22 + .12 * math.sin(phase * 3) - pulse * .24) end for _, stroke in group.strokes do stroke.Transparency = transparency end end end local stopWatching = Mobility.watchRunes(register, function(model) if model:IsA("Model") then visibleRunes[model], jumps[model] = nil, nil end end) local boostChanged: RBXScriptConnection? = nil local boostSound: Sound? = nil local jumpSound: Sound? = nil local function stopBoostSound() if not boostSound then return end boostSound:Destroy() boostSound = nil end local function stopMobilitySounds() stopBoostSound() if jumpSound then jumpSound:Destroy() jumpSound = nil end end local function watchBoost(character: Model) if boostChanged then boostChanged:Disconnect() end stopMobilitySounds() screen.reset() local function playBoostSound() local expiry = character:GetAttribute("ArenaBoostUntil") if character ~= player.Character or player:GetAttribute("InArena") ~= true or typeof(expiry) ~= "number" or expiry <= workspace:GetServerTimeNow() then return end stopBoostSound() boostSound = effects.sound("BoostRune") screen.boost(workspace:GetServerTimeNow(), expiry) end boostChanged = character:GetAttributeChangedSignal("ArenaBoostUntil"):Connect(playBoostSound) playBoostSound() end local respawned = player.CharacterAdded:Connect(watchBoost) if player.Character then watchBoost(player.Character) end local zone = player:GetAttributeChangedSignal("InArena"):Connect(function() if player:GetAttribute("InArena") ~= true then stopMobilitySounds() screen.reset() end end) local horizontalMask = Vector3.new(1, 0, 1) local lastCharacter: Model? = nil local lastJump: Rune? = nil -- The character's simulation owner adds lift before the next physics step, keeping normal air control. local hop = RunService.PreSimulation:Connect(function() local character = player.Character if character ~= lastCharacter or player:GetAttribute("InArena") ~= true then lastJump = nil end lastCharacter = character if not character or player:GetAttribute("InArena") ~= true then return end local mode = Modes.of(player) local now = workspace:GetServerTimeNow() if not Modes.open(round, mode, now) then return end local humanoid = character:FindFirstChildOfClass("Humanoid") local root = character:FindFirstChild("HumanoidRootPart") if not humanoid or humanoid.Health <= 0 or humanoid.Sit or not root or not root:IsA("BasePart") or root.Anchored then return end local position = root.Position if lastJump then if lastJump.mode == mode and lastJump.origin:IsDescendantOf(workspace) and ((position - lastJump.origin.Position) * horizontalMask).Magnitude < Mobility.JumpRadius + .65 then return end lastJump = nil end local velocity = root.AssemblyLinearVelocity if math.abs(velocity.Y) > 11 or (velocity * horizontalMask).Magnitude < .6 then return end local reach = Mobility.groundReach(root, humanoid) for model, rune in jumps do if rune.mode ~= mode then continue end local offset = position - rune.origin.Position if offset.Y <= .5 or offset.Y > reach + .4 or (offset * horizontalMask).Magnitude >= Mobility.JumpRadius then continue end local floor = workspace:Raycast(position, -Vector3.yAxis * reach, Modes.collision(mode)) if not floor or math.abs(floor.Position.Y - rune.origin.Position.Y) > .45 then continue end lastJump = rune Mobility.hop(root, humanoid) if jumpSound then jumpSound:Destroy() end jumpSound = effects.sound("JumpRune") screen.jump(now) rune.localPulse = now flash(rune, now) hopUsed:FireServer(model) return end end) local elapsed = 0 local step = RunService.RenderStepped:Connect(function(dt) elapsed += dt if elapsed < 1 / 60 then return end elapsed %= 1 / 60 local camera = workspace.CurrentCamera if not camera then return end local now = workspace:GetServerTimeNow() screen.render(now, viewmodel:GetAttribute("Aiming") == true) for model, rune in visibleRunes do if (camera.CFrame.Position - rune.origin.Position).Magnitude > 152 then continue end local trigger = (model:GetAttribute("PulseAt") :: number?) or 0 local age = math.max(0, now - math.max(trigger, rune.localPulse)) if trigger > rune.lastPulse then rune.lastPulse = trigger if now - trigger < .5 and math.abs(trigger - rune.localPulse) > .6 then flash(rune, now) end end animate(rune, now, math.max(0, 1 - age / .52) ^ 2) end for i = #waves, 1, -1 do local wave = waves[i] local t = (now - wave.startedAt) / .55 if t >= 1 then wave.model:Destroy() table.remove(waves, i) else wave.model:ScaleTo(1 + .78 * (1 - (1 - t) ^ 2)) wave.model:PivotTo(wave.pose + Vector3.yAxis * (.3 * t)) for _, stroke in wave.strokes do stroke.Transparency = .18 + .82 * t end end end end) script.Destroying:Once(function() step:Disconnect() hop:Disconnect() stopWatching() respawned:Disconnect() zone:Disconnect() if boostChanged then boostChanged:Disconnect() end stopMobilitySounds() screen.destroy() visualEffects:Destroy() end)