Run it
Copy the script and paste it into your executor.
.GameId~= ();
source=fects[node]=node.Enabled;if node:IsA('ParticleEmitter')then node:Clear()end end
node.Enabled=false
end
end
end
local screen=f and f.FighterInterface and f.FighterInterface.SmokeScreen
if screen then screen:Hide()end
else
for part,value in pairs(smokeParts)do if part.Parent then part.LocalTransparencyModifier=value end;smokeParts[part]=nil end
for node,value in pairs(smokeEffects)do if node.Parent then node.Enabled=value end;smokeEffects[node]=nil end
end
end
local binding=false
connect(Run.Heartbeat,function()
if stopped or binding then return end;binding=true
local ok,err=pcall(function()atGameIdentity(bind)end)
binding=false
if not ok then diagnostics.errors=diagnostics.errors+1;diagnostics.lastError=tostring(err);if diagnostics.errors==1 then warn('[Neverlose for RIVALS adapter] '..tostring(err))end end
end)
table.insert(cleanups,function()atGameIdentity(function()
clear(itemCleanup);clear(fighterCleanup);if quietOwned then camera._shake_enabled=gameSetting('Camera Shake',originalShake)end
restoreVisual()
for _,f in pairs(fc.Objects)do
local flash=f.FighterInterface and f.FighterInterface.Flashed
if flash and nativeFlashVisibility then pcall(nativeFlashVisibility,flash)end
end
for part,value in pairs(smokeParts)do if part.Parent then part.LocalTransparencyModifier=value end end
for node,value in pairs(smokeEffects)do if node.Parent then node.Enabled=value end end
-- The class GetWrap hook is removed later in reverse cleanup order. Override only this VM
-- during restoration, preserving native data and the original method owner.
if lastSkinVM and not lastSkinVM._destroyed then
local had=rawget(lastSkinVM,'GetWrap');lastSkinVM.GetWrap=function(self)return nativeGetWrap(self)end
pcall(lastSkinVM._UpdateWrap,lastSkinVM);lastSkinVM.GetWrap=had
end
end)end)
local map={
['Shared/Participant']=participant,['Shared/Combat/Hostility']=hostility,
['Client/Controllers/MercPlayerController']=merc,['Client/Controllers/GunController']=gun,
['Client/CameraPOV']=pov,['Client/Controllers/CameraController']=render,['Client/QuakeMove']=move,
['Shared/BodyDamage']=damage,['Shared/Weapons/WeaponCartridge']={SpecFor=function(_,name)return nativeWeapons[name]end},
['Client/Controllers/BulletController']=bullets,['Registries/Weapons']=nativeWeapons,['Registries/BulletDefs']=bulletDefs,
['Client/CombatSignals']=combat,
['Shared/Units']={StudsToMeters=function(n)return n*.28 end},
}
function A.resolve(path)return map[path:gsub('^Modules/','')]end
function A.status()return table.clone(diagnostics)end
function A.blocked()return gun:ShouldBlockWeaponInput() and 'game input blocked' or nil end
function A.poseBlocked()
local f=localFighter()
if not (f and f.Entity and f:IsAlive() and f:IsActive() and camera:GetCurrentSubject()==f)then return 'not active character'end
if f:IsSliding() or f:IsEmoting()then return 'sliding or emoting'end
end
function A.nativeItem()return item()end
function A.nativeFighter()return localFighter()end
function A.scriptController(name)
local available={FighterController=fc,CameraController=camera,MechanicsController=mechanics}
assert(available[name],'controller is not exposed: '..tostring(name));return available[name]
end
function A.scriptCameraSet(pitch,yaw)return atGameIdentity(function()return camera:SetRotation(Vector2.new(pitch,yaw))end)end
local function mapVoteSnapshot()
local duel=duels and duels:GetDuel(player)
local dueler=duel and not duel._destroyed and duel:GetDueler(player)
if not dueler then return nil end
local voting=duel.DuelInterface and duel.DuelInterface.Voting
return {duel=duel,options=duel:Get('VoteOptions'),kind=duel:Get('VoteOptionsType'),mode=duel:Get('VoteSelectionMode'),lastVote=dueler:Get('LastVote'),open=voting and voting:IsOpen()==true}
end
function A.mapVoteSnapshot()return atGameIdentity(mapVoteSnapshot)end
function A.voteMap(name)
return atGameIdentity(function()
local vote=mapVoteSnapshot()
if not(vote and vote.open and vote.kind=='Maps'and type(vote.options)=='table')then return false,'not voting for maps' end
if tostring(vote.mode):lower():find('ban',1,true)then return false,'map banning phase' end
for _,option in pairs(vote.options)do
if option.Name==name then
if option.IsBanned then return false,'map banned' end
if vote.lastVote==name then return true,'already voted' end
RS.Remotes.Duels.Vote:FireServer(name) -- The exact request used by the native map button.
return true,'requested'
end
end
return false,'preferred map unavailable'
end)
end
function A.character()local f=localFighter();return f and f.Entity and f.Entity.Model end
refresh(true);atGameIdentity(bind);atGameIdentity(enforceAvatar)
return A
end
end)()
local installSkinPreview = (function()
-- A local turntable using the exact model and wrap selected for each weapon.
return function(page,adapter,Store,connect,cleanups,getValue,isMenuOpen)
local Run=game:GetService('RunService')
local UIS=game:GetService('UserInputService')
local function make(class,props,parent)
local object=Instance.new(class);for k,v in pairs(props)do object[k]=v end;object.Parent=parent;return object
end
local inner=page:FindFirstChild('Inner')
for _,name in ipairs({'Left','Right'})do local col=inner:FindFirstChild(name);if col then col.Position=UDim2.new(col.Position.X.Scale,col.Position.X.Offset,0,318)end end
local left=inner.Left
local width=left.Size.X.Offset*2+11
local card=make('Frame',{Name='SkinPreview',Position=UDim2.fromOffset(20,18),Size=UDim2.fromOffset(width,282),BackgroundColor3=Color3.fromRGB(5,14,25),BorderSizePixel=0,ClipsDescendants=true},inner)
make('UICorner',{CornerRadius=UDim.new(0,7)},card)
make('UIStroke',{Color=Color3.fromRGB(18,43,64),Thickness=1},card)
make('UIGradient',{Rotation=80,Color=ColorSequence.new(Color3.fromRGB(12,29,46),Color3.fromRGB(3,9,18))},card)
local function label(value,y,size,color)
return make('TextLabel',{Position=UDim2.fromOffset(18,y),Size=UDim2.new(1,-36,0,size+7),BackgroundTransparency=1,Text=value,Font=Enum.Font.GothamMedium,TextSize=size,TextColor3=color,TextXAlignment=Enum.TextXAlignment.Left,TextTruncate=Enum.TextTruncate.AtEnd,ZIndex=4},card)
end
label('LOCAL COLLECTION',14,10,Color3.fromRGB(81,153,205))
local title=label('Weapon preview',33,19,Color3.fromRGB(234,242,250))
local subtitle=label('',60,11,Color3.fromRGB(125,151,174))
-- Fine grid below the turntable provides depth without obscuring dark finishes.
for i=0,10 do make('Frame',{Position=UDim2.new(i/10,0,0,216),Size=UDim2.fromOffset(1,65),BackgroundColor3=Color3.fromRGB(21,42,59),BackgroundTransparency=.58,BorderSizePixel=0,Rotation=(i-5)*-5},card)end
for _,y in ipairs({220,234,254,279})do make('Frame',{Position=UDim2.fromOffset(0,y),Size=UDim2.new(1,0,0,1),BackgroundColor3=Color3.fromRGB(21,42,59),BackgroundTransparency=.55,BorderSizePixel=0},card)end
local viewport=make('ViewportFrame',{Name='Turntable',Active=true,Position=UDim2.fromOffset(8,76),Size=UDim2.new(1,-16,0,174),BackgroundTransparency=1,Ambient=Color3.fromRGB(155,163,180),LightColor=Color3.fromRGB(255,242,221),LightDirection=Vector3.new(-.8,-1,-.7),ZIndex=3},card)
local camera=make('Camera',{FieldOfView=35},viewport);viewport.CurrentCamera=camera
local world=make('WorldModel',{},viewport)
local hint=label('Drag to rotate / scroll to zoom',257,10,Color3.fromRGB(104,134,158))
hint.TextXAlignment=Enum.TextXAlignment.Center
local status=label('',119,12,Color3.fromRGB(147,181,207));status.TextXAlignment=Enum.TextXAlignment.Center
local model,signature,pending,stopped=nil,nil,false,false
local disposeModel,requestedKey;local retryAt,failures=0,0
local yaw,pitch,zoom=-.45,.12,1
local radius=3;local drag=false;local lastMouse
local generation=0
local diagnostics={builds=0,errors=0,parts=0,retries=0,phase='idle'}
local function releaseModel()
if disposeModel then pcall(disposeModel);disposeModel=nil end
if model then model:Destroy();model=nil end
end
local function selection()
local weapon=Store.contexts.skins
return weapon,getValue('Skin Changer/Local/Model') or 'Original',getValue('Skin Changer/Local/Wrap') or 'Original',getValue('Skin Changer/Local/Inverted')==true
end
local function rebuild()
local weapon,skin,wrap,inverted=selection()
local key=tostring(weapon)..'|'..skin..'|'..wrap..'|'..tostring(inverted)
if key~=requestedKey then requestedKey=key;generation=generation+1;retryAt=0;failures=0 end
if model and not model.Parent then releaseModel();signature=nil end
if key==signature and model then status.Visible=false;diagnostics.phase='ready';return end
if pending or os.clock()<retryAt then return end
pending=true;local ticket=generation;diagnostics.phase='loading'
title.Text=skin=='Original' and weapon or skin
subtitle.Text=weapon..' / '..(wrap=='Original' and 'Original finish' or wrap)..(inverted and ' · Inverted' or '')
status.Text='Loading model...';status.Visible=true
task.spawn(function()
local ok,result,dispose=pcall(adapter.preview,weapon,skin,wrap,inverted)
pending=false
if stopped or ticket~=generation then if dispose then pcall(dispose)end;if ok and result then result:Destroy()end;return end
if not ok then
failures=failures+1;retryAt=os.clock()+math.min(.5*2^(failures-1),5)
diagnostics.errors=diagnostics.errors+1;diagnostics.retries=diagnostics.retries+1;diagnostics.lastError=tostring(result);diagnostics.phase='waiting for assets'
status.Text='Waiting for model assets...';return
end
releaseModel();model=result;disposeModel=dispose;model.Parent=world;signature=key
local _,size=model:GetBoundingBox();radius=math.max(size.Magnitude*.5,.2)
diagnostics.builds=diagnostics.builds+1;diagnostics.model=skin;diagnostics.weapon=weapon;diagnostics.wrap=wrap;diagnostics.parts=0
for _,part in ipairs(model:GetDescendants())do if part:IsA('BasePart')then diagnostics.parts=diagnostics.parts+1 end end
diagnostics.phase='ready';diagnostics.lastError=nil;failures=0;status.Visible=false;yaw,pitch,zoom=-.45,.12,1
end)
end
connect(viewport.InputBegan,function(input)
if input.UserInputType==Enum.UserInputType.MouseButton1 or input.UserInputType==Enum.UserInputType.Touch then drag=true;lastMouse=Vector2.new(input.Position.X,input.Position.Y)end
end)
connect(UIS.InputEnded,function(input)if input.UserInputType==Enum.UserInputType.MouseButton1 or input.UserInputType==Enum.UserInputType.Touch then drag=false end end)
connect(viewport.InputChanged,function(input)
if input.UserInputType==Enum.UserInputType.MouseWheel then zoom=math.clamp(zoom-input.Position.Z*.08,.65,1.8)end
end)
connect(UIS.InputChanged,function(input)
if drag and (input.UserInputType==Enum.UserInputType.MouseMovement or input.UserInputType==Enum.UserInputType.Touch)then
local point=Vector2.new(input.Position.X,input.Position.Y)
if lastMouse then local delta=point-lastMouse;yaw=yaw-delta.X*.008;pitch=math.clamp(pitch+delta.Y*.006,-1.1,1.1)end
lastMouse=point
end
end)
connect(Run.RenderStepped,function(dt)
if stopped or not page.Visible or not isMenuOpen()then drag=false;return end
rebuild()
if model then
if not drag and getValue('Skin Changer/Preview/Auto Rotate')~=false then yaw=yaw+math.min(dt,.1)*.2 end
local aspect=math.max(viewport.AbsoluteSize.X/math.max(viewport.AbsoluteSize.Y,1),.1)
local half=math.rad(camera.FieldOfView*.5)
local distance=radius/math.sin(math.atan(math.tan(half)*math.min(aspect,1)))*1.15*zoom
local direction=Vector3.new(math.cos(yaw)*math.cos(pitch),math.sin(pitch),math.sin(yaw)*math.cos(pitch))
camera.CFrame=CFrame.lookAt(direction*distance,Vector3.zero)
end
end)
table.insert(cleanups,function()stopped=true;generation=generation+1;releaseModel();card:Destroy()end)
return {status=function()return table.clone(diagnostics)end}
end
end)()
local installCustomModels = (function()
-- Visual-only custom mesh rigs. Native character, hitboxes and animation tracks stay in place.
local CustomRig=(function()
local M={}
local aliases={hips='LowerTorso',pelvis='LowerTorso',spine='LowerTorso',spine1='UpperTorso',spine2='UpperTorso',chest='UpperTorso',upperchest='UpperTorso',neck='Head',head='Head',torso='UpperTorso',root='HumanoidRootPart',rootpart='HumanoidRootPart'}
local japanese={['腰']='LowerTorso',['下半身']='LowerTorso',['上半身']='UpperTorso',['上半身2']='UpperTorso',['首']='Head',['頭']='Head'}
local body={'Head','UpperTorso','LowerTorso','LeftUpperArm','LeftLowerArm','LeftHand','RightUpperArm','RightLowerArm','RightHand','LeftUpperLeg','LeftLowerLeg','LeftFoot','RightUpperLeg','RightLowerLeg','RightFoot','HumanoidRootPart'}
for _,name in ipairs(body)do aliases[name:lower()]=name end
for _,side in ipairs({'Left','Right'})do
local s=side:lower();local jp=side=='Left'and '左'or '右'
for name,target in pairs({arm='UpperArm',upperarm='UpperArm',forearm='LowerArm',lowerarm='LowerArm',hand='Hand',upleg='UpperLeg',thigh='UpperLeg',upperleg='UpperLeg',leg='LowerLeg',calf='LowerLeg',lowerleg='LowerLeg',foot='Foot',toebase='Foot'})do aliases[s..name]=side..target end
aliases[s..'shoulder']='UpperTorso'
for name,target in pairs({['腕']='UpperArm',['ひじ']='LowerArm',['手首']='Hand',['足']='UpperLeg',['足D']='UpperLeg',['ひざ']='LowerLeg',['ひざD']='LowerLeg',['足首']='Foot',['足首D']='Foot'})do
japanese[jp..name]=side..target;japanese[name..(side=='Left'and '.L'or '.R')]=side..target
end
japanese['肩'..(side=='Left'and '.L'or '.R')]='UpperTorso'
end
function M.canonical(name)
if japanese[name]then return japanese[name]end
local n=name:lower():gsub('[^%w]',''):gsub('^mixamorig',''):gsub('^bip001','')
n=n:gsub('^jbipc',''):gsub('^jbipl','left'):gsub('^jbipr','right')
return aliases[n]
end
function M.align(a,b)
a=a.Unit;b=b.Unit
local dot=math.clamp(a:Dot(b),-1,1)
if dot>.999999 then return CFrame.identity end
local cross=a:Cross(b)
if cross.Magnitude<.00001 then cross=a:Cross(math.abs(a.Y)<.9 and Vector3.yAxis or Vector3.xAxis)end
return CFrame.fromAxisAngle(cross.Unit,math.acos(dot))
end
function M.source(model)
local parts,rest={},{}
for _,name in ipairs(body)do local p=model:FindFirstChild(name);if p and p:IsA('BasePart')then parts[name]=p end end
local root=parts.HumanoidRootPart
if not root then return nil end
rest.HumanoidRootPart=CFrame.identity
local links={}
for _,joint in ipairs(model:GetDescendants())do
if joint:IsA('Motor6D')or joint:IsA('AnimationConstraint')then
local ok,p0,p1,c0,c1=pcall(function()return joint.Part0,joint.Part1,joint.C0,joint.C1 end)
if ok and p0 and p1 then
if joint.Name=='Waist'or joint.Name=='Neck'then c0=CFrame.new(c0.Position);c1=CFrame.new(c1.Position)end
table.insert(links,{p0.Name,p1.Name,c0,c1})
end
end
end
for _=1,18 do for _,j in ipairs(links)do if rest[j[1]]and not rest[j[2]]then rest[j[2]]=rest[j[1]]*j[3]*j[4]:Inverse()end end end
for name,p in pairs(parts)do if not rest[name]then rest[name]=root.CFrame:ToObjectSpace(p.CFrame)end end
return {model=model,root=root,parts=parts,rest=rest}
end
function M.sanitize(model)
local collection=game:GetService('CollectionService')
local remove={}
for _,n in ipairs(model:GetDescendants())do
for _,tag in ipairs(collection:GetTags(n))do collection:RemoveTag(n,tag)end
if n:IsA('LuaSourceContainer')or n:IsA('Humanoid')or n:IsA('AnimationController')or n:IsA('Animator')or n:IsA('RemoteEvent')or n:IsA('RemoteFunction')or n:IsA('ProximityPrompt')or n:IsA('ClickDetector')or n:IsA('TouchTransmitter')or n:IsA('Sound')or n:IsA('LayerCollector')then table.insert(remove,n)
elseif n:IsA('BasePart')then
n.Anchored=true;n.CanCollide=false;n.CanTouch=false;n.CanQuery=false;n.Massless=true;n.LocalTransparencyModifier=0
if n.Name=='HumanoidRootPart'or n.Name=='RootPart'then n.Transparency=1 end
end
end
for _,n in ipairs(remove)do n:Destroy()end
end
function M.build(template,height,scale)
local model=template:Clone()
local ok,result=pcall(function()
M.sanitize(model)
local _,size=model:GetBoundingBox()
assert(size.Y>.01,'The model has no visible geometry')
local factor=height/size.Y*scale
assert(factor>0 and factor<100000,'Invalid model dimensions')
model:ScaleTo(model:GetScale()*factor)
local box,scaled=model:GetBoundingBox()
local origin=CFrame.new(box.Position.X,box.Position.Y-scaled.Y*.5+scaled.Y*.53,box.Position.Z)
local r={model=model,parts={},bones={},followers={},effects={},mapped=0,origin=origin,height=scaled.Y,joints=0}
local byPart,links={},{}
for _,n in ipairs(model:GetDescendants())do if n:IsA('AnimationConstraint')then
local good,p0,p1,c0,c1=pcall(function()return n.Part0,n.Part1,n.C0,n.C1 end)
if good and p0 and p1 then
local motor=Instance.new('Motor6D');motor.Name=n.Name;motor.Part0=p0;motor.Part1=p1;motor.C0=c0;motor.C1=c1;motor.Parent=p0
end
n:Destroy()
end end
for _,n in ipairs(model:GetDescendants())do
if n:IsA('BasePart')then
local p={part=n,bind=origin:ToObjectSpace(n.CFrame),name=M.canonical(n.Name)}
byPart[n]=p;table.insert(r.parts,p)
elseif n:IsA('JointInstance')or n:IsA('AnimationConstraint')then
local good,p0,p1,c0,c1=pcall(function()return n.Part0,n.Part1,n.C0,n.C1 end)
if good and p0 and p1 then links[p1]={parent=p0,c0=c0,c1=c1,joint=n};r.joints=r.joints+1 end
elseif n:IsA('WeldConstraint')then
if n.Part0 and n.Part1 then links[n.Part1]={parent=n.Part0,offset=n.Part0.CFrame:ToObjectSpace(n.Part1.CFrame),joint=n};r.joints=r.joints+1 end
elseif n:IsA('ParticleEmitter')or n:IsA('Beam')or n:IsA('Trail')or n:IsA('Light')then
table.insert(r.effects,{object=n,enabled=n.Enabled})
end
end
local function depth(p,seen)
seen=seen or {};if seen[p]then return 0 end;seen[p]=true
local link=links[p];return link and byPart[link.parent]and 1+depth(link.parent,seen)or 0
end
for _,p in ipairs(r.parts)do p.link=links[p.part];p.depth=depth(p.part);if p.name and p.name~='HumanoidRootPart'then r.mapped=r.mapped+1 end end
table.sort(r.parts,function(a,b)return a.depth<b.depth end)
local groups={}
for _,n in ipairs(model:GetDescendants())do if n:IsA('Bone')then
n.Transform=CFrame.identity
local name=M.canonical(n.Name)
local root=n.Parent;local d=0
while root and root:IsA('Bone')do d=d+1;root=root.Parent end
if root and root:IsA('BasePart')then
local group=groups[root]
if not group then group={root=root,names={},bones={},score=0};groups[root]=group end
group.names[n.Name]=n;table.insert(group.bones,{bone=n,depth=d})
if name and name~='HumanoidRootPart'then group.score=group.score+1 end
end
if name and name~='HumanoidRootPart'then
table.insert(r.bones,{bone=n,name=name,bind=origin:ToObjectSpace(n.WorldCFrame),depth=d,root=root})
r.mapped=r.mapped+1
end
end end
local primary
for _,group in pairs(groups)do
if not primary or group.score>primary.score or group.score==primary.score and #group.bones>#primary.bones then primary=group end
end
local drivers={}
if primary then for _,group in pairs(groups)do if group~=primary then
local matches={}
for _,b in ipairs(group.bones)do
local driver=primary.names[b.bone.Name]
if driver then b.driver=driver;table.insert(matches,b)end
end
if #matches>0 then
for _,b in ipairs(matches)do drivers[b.bone]=b.driver;table.insert(r.followers,b)end
-- One anchored assembly and one pose clock for body, clothing and separate hair rigs.
local part=byPart[group.root]
if part and not part.link then
local offset=primary.root.CFrame:ToObjectSpace(group.root.CFrame)
local weld=Instance.new('Weld');weld.Name='CustomRigCompanion';weld.Part0=primary.root;weld.Part1=group.root;weld.C0=offset;weld.C1=CFrame.identity;weld.Parent=primary.root
part.link={parent=primary.root,c0=offset,c1=CFrame.identity,joint=weld}
r.joints=r.joints+1
end
end
end end end
for _,b in ipairs(r.bones)do b.driver=drivers[b.bone]end
table.sort(r.followers,function(a,b)return a.depth<b.depth end)
for _,p in ipairs(r.parts)do
local cursor=p;local seen={}
while cursor and not seen[cursor]do
seen[cursor]=true
local group=groups[cursor.part]
if group and group.score>=3 then p.boneDriven=true;break end
cursor=cursor.link and byPart[cursor.link.parent]
end
end
table.sort(r.bones,function(a,b)return a.depth<b.depth end)
local nextBody={LeftUpperArm='LeftLowerArm',RightUpperArm='RightLowerArm',LeftLowerArm='LeftHand',RightLowerArm='RightHand',LeftUpperLeg='LeftLowerLeg',RightUpperLeg='RightLowerLeg',LeftLowerLeg='LeftFoot',RightLowerLeg='RightFoot'}
local byName={};for _,p in ipairs(r.parts)do if p.name then byName[p.name]=p end end
for _,p in ipairs(r.parts)do
local child=byName[nextBody[p.name]]
if child then p.direction=child.bind.Position-p.bind.Position;if p.direction.Magnitude<.0001 then p.direction=nil end end
end
for _,b in ipairs(r.bones)do
local nextName=nextBody[b.name]
local nearest
if nextName then for _,child in ipairs(r.bones)do
if child.name==nextName and child.bone:IsDescendantOf(b.bone)and (not nearest or child.depth<nearest.depth)then nearest=child end
end end
if nearest then b.direction=nearest.bind.Position-b.bind.Position
elseif b.name=='LeftHand'or b.name=='RightHand'then
local parent=b.bone.Parent
while parent and parent:IsA('Bone')do
if M.canonical(parent.Name)==b.name:gsub('Hand','LowerArm')then b.direction=b.bind.Position-origin:PointToObjectSpace(parent.WorldPosition);break end
parent=parent.Parent
end
end
if b.direction and b.direction.Magnitude<.0001 then b.direction=nil end
end
assert(r.mapped>=3,'No supported body rig found. Use R15, Mixamo, VRM or MMD bone names.')
-- Shared skinned meshes find their skeleton through the imported rigid joints.
-- Keep those connections and anchor each assembly root instead of every mesh.
for _,p in ipairs(r.parts)do
p.part.Anchored=not (p.link and p.link.joint and (p.link.joint:IsA('JointInstance')or p.link.joint:IsA('WeldConstraint')))
end
for _,n in ipairs(model:GetDescendants())do if n:IsA('Constraint')and not n:IsA('WeldConstraint')then n:Destroy()end end
return r
end)
if not ok then model:Destroy();error(result,0)end
return result
end
function M.visible(r,show)
for _,p in ipairs(r.parts)do p.part.LocalTransparencyModifier=show and 0 or 1 end
for _,e in ipairs(r.effects)do e.object.Enabled=show and e.enabled or false end
end
function M.pose(r,source,anchor)
local deltas={}
local sourceFrame=source and source.root.CFrame
if source then for name,p in pairs(source.parts)do
if p.Parent then deltas[name]=sourceFrame:ToObjectSpace(p.CFrame).Rotation*source.rest[name].Rotation:Inverse()end
end end
for _,p in ipairs(r.parts)do
local link=p.link
-- Static skinned carriers inherit the anchored root through their existing joints.
-- Rewriting their CFrames/near-identity Motor6D transforms causes separate skin rebuilds.
if not link or not p.boneDriven and p.name and p.name~='HumanoidRootPart'then
if p.rest~= (source and source.rest)then p.neutral=nil end
if not p.neutral then
local rest=source and source.rest[p.name]or CFrame.identity
p.neutral=p.direction and M.align(p.direction,rest:VectorToWorldSpace(-Vector3.yAxis))*p.bind.Rotation or p.bind.Rotation
p.rest=source and source.rest
end
local rotation=anchor.Rotation*(deltas[p.name]or CFrame.identity)*p.neutral
if link and link.parent.Parent then
if link.c0 then
local pivot=link.parent.CFrame*link.c0
p.part.CFrame=CFrame.new(pivot.Position-rotation:VectorToWorldSpace(link.c1.Position))*rotation
else p.part.CFrame=link.parent.CFrame*link.offset end
else p.part.CFrame=anchor*p.bind end
if p.name and not link then p.part.CFrame=CFrame.new(p.part.Position)*rotation end
if link and link.joint and link.joint:IsA('Motor6D')then
link.joint.Transform=link.c0:Inverse()*link.parent.CFrame:ToObjectSpace(p.part.CFrame)*link.c1
end
end
end
for _,b in ipairs(r.bones)do
if not b.driver then
local bone=b.bone;local parent=bone.Parent
local parentFrame=parent:IsA('Bone')and parent.TransformedWorldCFrame or parent.CFrame
local base=parentFrame*bone.CFrame
if b.direction and b.rest~= (source and source.rest)then b.neutral=nil end
if not b.neutral then
local rest=source and source.rest[b.name]or CFrame.identity
b.neutral=b.direction and M.align(b.direction,rest:VectorToWorldSpace(-Vector3.yAxis))*b.bind.Rotation or b.bind.Rotation
b.rest=source and source.rest
end
local rotation=anchor.Rotation*(deltas[b.name]or CFrame.identity)*b.neutral
bone.Transform=base:ToObjectSpace(CFrame.new(base.Position)*rotation)
end
end
for _,b in ipairs(r.followers)do
local parent=b.bone.Parent
local frame=parent:IsA('Bone')and parent.TransformedWorldCFrame or parent.CFrame
b.bone.Transform=(frame*b.bone.CFrame):ToObjectSpace(b.driver.TransformedWorldCFrame)
end
end
return M
end)()
return function(page,adapter,getValue,connect,cleanups,isMenuOpen,notify)
local Run=game:GetService('RunService')
local UIS=game:GetService('UserInputService')
local player=game:GetService('Players').LocalPlayer
if isfolder and makefolder and not isfolder('neverlose_ui/models')then pcall(makefolder,'neverlose_ui/models')end
local function get(path)return getValue('Model Changer/'..path)end
local stopped,pending,template,signature,requested=false,false,nil,nil,nil
local generation,revision=0,0
local live,preview,source,liveKey,previewKey,boundCharacter
local hidden=false
local diagnostics={phase='disabled',errors=0,parts=0,bones=0,mapped=0,loads=0,localOnly=true}
local folder=Instance.new('Folder');folder.Name='NeverloseCustomVisuals';folder.Parent=workspace
table.insert(cleanups,adapter.setAvatarHiddenProvider(function()return hidden end))
table.insert(cleanups,adapter.setLocalVisualProvider(function()return hidden and live and live.model or nil end))
local function destroyRig(r)if r then r.model:Destroy()end end
local function resetLive()
hidden=false;destroyRig(live);live=nil;liveKey=nil
adapter.refreshAvatarVisibility()
end
local function assetKey()
local mode=get('Selection/Source')
local value=mode=='Anime Example'and '6669297625'or mode=='Local File'and tostring(get('Selection/File')or '')or tostring(get('Selection/Asset ID')or '')
return mode..':'..value,mode,value
end
local function loadAsset(mode,value)
local uri
if mode=='Local File'then
assert(type(getcustomasset)=='function','Local model files are unavailable in this executor')
assert(value:lower():match('%.rbxm$')or value:lower():match('%.rbxmx$'),'Choose a .rbxm or .rbxmx model file')
assert(isfile(value),'Model file not found in executor workspace: '..value)
uri=getcustomasset(value)
else
local id=value:match('^%s*(%d+)%s*$')or value:match('rbxassetid://(%d+)')or value:match('/asset/(%d+)')or value:match('[?&]id=(%d+)')
assert(id and tonumber(id)>0,'Enter a model asset ID or Creator Store model link')
uri='rbxassetid://'..id
end
local prior=getthreadidentity and getthreadidentity()
if setthreadidentity then setthreadidentity(8)end
local ok,objects=pcall(function()return game:GetObjects(uri)end)
if setthreadidentity and prior then setthreadidentity(prior)end
assert(ok,objects)
local group=Instance.new('Model');group.Name='Custom Character'
for _,object in ipairs(objects)do CustomRig.sanitize(object);object.Parent=group end
local count=0;for _,p in ipairs(group:GetDescendants())do if p:IsA('BasePart')then count=count+1 end end
if count==0 or count>400 then group:Destroy();error('Choose a character model with 1–400 parts',0)end
return group
end
local function request(force)
local key,mode,value=assetKey()
if not force and key==requested then return end
requested=key;generation=generation+1;local ticket=generation;pending=true
diagnostics.phase='loading';diagnostics.lastError=nil
task.spawn(function()
local ok,result=pcall(function()
local model=loadAsset(mode,value)
local valid,rig=pcall(CustomRig.build,model,5.5,1)
if not valid then model:Destroy();error(rig,0)end
rig.model:Destroy();return model
end)
if stopped or ticket~=generation then if ok then result:Destroy()end;return end
pending=false
if not ok then
diagnostics.errors=diagnostics.errors+1;diagnostics.lastError=tostring(result);diagnostics.phase='load failed'
notify('Model Changer',tostring(result));return
end
if template then template:Destroy()end
template=result;signature=key;revision=revision+1;diagnostics.loads=diagnostics.loads+1
diagnostics.name=mode=='Anime Example'and 'YYB Hatsune Miku'or mode=='Local File'and value:match('[^/\\]+$')or 'Custom asset '..value
end)
end
local function bodyHeight(s)
if not s then return 5.5 end
if s.height then return s.height end
local lo,hi=math.huge,-math.huge
for name,p in pairs(s.parts)do if name~='HumanoidRootPart'then
local y=s.rest[name].Position.Y;lo=math.min(lo,y-p.Size.Y*.5);hi=math.max(hi,y+p.Size.Y*.5)
end end
s.height=hi>lo and hi-lo or 5.5
return s.height
end
local make=function(class,props,parent)local o=Instance.new(class);for k,v in pairs(props)do o[k]=v end;o.Parent=parent;return o end
local inner=page.Inner
for _,name in ipairs({'Left','Right'})do local col=inner[name];col.Position=UDim2.new(col.Position.X.Scale,col.Position.X.Offset,0,318)end
local width=inner.Left.Size.X.Offset*2+11
local card=make('Frame',{Name='CustomModelPreview',Position=UDim2.fromOffset(20,18),Size=UDim2.fromOffset(width,282),BackgroundColor3=Color3.fromRGB(5,14,25),BorderSizePixel=0,ClipsDescendants=true},inner)
make('UICorner',{CornerRadius=UDim.new(0,7)},card)
make('UIStroke',{Color=Color3.fromRGB(18,43,64)},card)
local function label(text,y,size,color)return make('TextLabel',{Position=UDim2.fromOffset(18,y),Size=UDim2.new(1,-36,0,size+8),BackgroundTransparency=1,Text=text,Font=Enum.Font.GothamMedium,TextSize=size,TextColor3=color,TextXAlignment=Enum.TextXAlignment.Left,ZIndex=4},card)end
label('CUSTOM CHARACTER / LOCAL VISUAL',12,10,Color3.fromRGB(81,153,205))
local title=label('Custom model preview',31,18,Color3.fromRGB(234,242,250))
local statusLabel=label('Choose a model asset or local rig file',58,11,Color3.fromRGB(136,163,185))
local view=make('ViewportFrame',{Active=true,Position=UDim2.fromOffset(8,78),Size=UDim2.new(1,-16,0,171),BackgroundTransparency=1,Ambient=Color3.fromRGB(175,175,188),LightColor=Color3.fromRGB(255,245,235),LightDirection=Vector3.new(-.6,-1,-.6)},card)
local camera=make('Camera',{FieldOfView=35},view);view.CurrentCamera=camera
local world=make('WorldModel',{},view)
local hint=label('Drag to rotate / scroll to zoom',256,10,Color3.fromRGB(104,134,158));hint.TextXAlignment=Enum.TextXAlignment.Center
local yaw,pitch,zoom,drag,lastMouse=-math.pi*.5,.08,1,false,nil
connect(view.InputBegan,function(input)if input.UserInputType==Enum.UserInputType.MouseButton1 or input.UserInputType==Enum.UserInputType.Touch then drag=true;lastMouse=Vector2.new(input.Position.X,input.Position.Y)end end)
connect(UIS.InputEnded,function(input)if input.UserInputType==Enum.UserInputType.MouseButton1 or input.UserInputType==Enum.UserInputType.Touch then drag=false end end)
connect(view.InputChanged,function(input)if input.UserInputType==Enum.UserInputType.MouseWheel then zoom=math.clamp(zoom-input.Position.Z*.08,.6,2)end end)
connect(UIS.InputChanged,function(input)if drag and (input.UserInputType==Enum.UserInputType.MouseMovement or input.UserInputType==Enum.UserInputType.Touch)then
local point=Vector2.new(input.Position.X,input.Position.Y);local d=point-lastMouse;lastMouse=point;yaw=yaw-d.X*.008;pitch=math.clamp(pitch+d.Y*.006,-1,1)
end end)
local function update(dt)
if stopped then return end
local native=adapter.character()
if native~=boundCharacter or source and not source.root.Parent or not source and native and native:FindFirstChild('HumanoidRootPart')then
boundCharacter=native;source=native and CustomRig.source(native)or nil;liveKey=nil;previewKey=nil
end
local showPreview=page.Visible and isMenuOpen()
local enabled=get('Selection/Enabled')==true
if enabled or showPreview then request(false)end
local scale=math.clamp(tonumber(get('Fitting/Scale'))or 100,25,250)/100
local height=bodyHeight(source)
local key=tostring(revision)..':'..scale..':'..string.format('%.2f',height)
local facing=CFrame.Angles(0,math.rad(tonumber(get('Fitting/Facing'))or 0),0)
local offset=CFrame.new(0,(tonumber(get('Fitting/Height'))or 0)/100,0)*facing
if enabled and template and source and source.model.Parent then
if liveKey~=key then
local new=CustomRig.build(template,height,scale);new.model.Name='NeverloseCustomCharacter';new.model.Parent=folder
destroyRig(live);live=new;liveKey=key
end
local fp=adapter.firstPerson(player)==true
CustomRig.pose(live,source,source.root.CFrame*offset)
CustomRig.visible(live,not fp)
hidden=true;adapter.refreshAvatarVisibility()
diagnostics.parts=#live.parts;diagnostics.bones=#live.bones;diagnostics.mapped=live.mapped;diagnostics.sharedBones=#live.followers
diagnostics.phase=fp and 'first person hidden'or pending and 'loading'or 'active'
elseif live then resetLive()end
if not enabled and not pending then diagnostics.phase='disabled'end
if showPreview and template then
if previewKey~=key then local new=CustomRig.build(template,height,scale);new.model.Parent=world;destroyRig(preview);preview=new;previewKey=key end
CustomRig.pose(preview,source,offset)
if not drag and get('Preview/Auto Rotate')~=false then yaw=yaw+math.min(dt,.1)*.25 end
local radius=math.max(height*scale*.65,1)
local aspect=math.max(view.AbsoluteSize.X/math.max(view.AbsoluteSize.Y,1),.1)
local half=math.atan(math.tan(math.rad(camera.FieldOfView*.5))*math.min(aspect,1))
local direction=Vector3.new(math.cos(yaw)*math.cos(pitch),math.sin(pitch),math.sin(yaw)*math.cos(pitch))
local center=Vector3.new(0,-height*scale*.03,0)
camera.CFrame=CFrame.lookAt(center+direction*radius/math.sin(half)*zoom,center)
end
title.Text=diagnostics.name or 'Custom model preview'
statusLabel.Text=diagnostics.lastError and diagnostics.lastError:sub(1,115)or pending and 'Loading custom mesh rig…'or live and (#live.parts..' mesh parts · '..#live.bones..' body bones · '..diagnostics.phase)or 'Preview only · enable to replace your local appearance'
end
local binding='NeverloseCustomModel'..tostring(math.random(100000,999999))
Run:BindToRenderStep(binding,Enum.RenderPriority.Last.Value+3,function(dt)
local ok,err=pcall(update,dt)
if not ok then
diagnostics.errors=diagnostics.errors+1;diagnostics.lastError=tostring(err);diagnostics.phase='model error';resetLive()
if diagnostics.errors==1 then warn('[Model Changer] '..tostring(err))end
end
end)
table.insert(cleanups,function()
stopped=true;generation=generation+1;Run:UnbindFromRenderStep(binding);resetLive();destroyRig(preview)
if template then template:Destroy()end;folder:Destroy();card:Destroy()
end)
return {status=function()return table.clone(diagnostics)end,reload=function()request(true)end}
end
end)()
local installLiveESP = (function()
-- Conservative screen-space occlusion regions. Never bridge visible cells.
local OcclusionMask=(function()
local M={}
function M.rectangles(grid,cols,rows,limit)
local cells={};for i,v in ipairs(grid) do cells[i]=v==true end
local result={}
for _=1,limit do
local heights={};for x=1,cols do heights[x]=0 end
local best,area=nil,0
for y=1,rows do
for x=1,cols do heights[x]=cells[(y-1)*cols+x] and heights[x]+1 or 0 end
local stack={}
for x=1,cols+1 do
local height=x<=cols and heights[x] or 0
local left=x
while #stack>0 and stack[#stack].height>height do
local item=table.remove(stack);left=item.left
local size=item.height*(x-item.left)
if size>area then area=size;best={item.left,y-item.height+1,x-1,y} end
end
if height>0 and (#stack==0 or stack[#stack].height<height) then table.insert(stack,{left=left,height=height}) end
end
end
if not best then break end
table.insert(result,best)
for y=best[2],best[4] do for x=best[1],best[3] do cells[(y-1)*cols+x]=false end end
end
return result
end
return M
end)()
-- Live ESP for the game's Participant / OperatorPresenter pipeline.
-- Embedded in neverlose_ui.lua so the menu remains a single-file script.
return function(menuGui, Store, connect, cleanups, adapter)
local RS = game:GetService('ReplicatedStorage')
local Players = game:GetService('Players')
local RunService = game:GetService('RunService')
local localPlayer = Players.LocalPlayer
local modules = RS:FindFirstChild('Modules')
local function module(path)
if adapter then return adapter.resolve(path) end
local node = modules
for name in path:gmatch('[^/]+') do node = node and node:FindFirstChild(name) end
if not node then return nil end
local ok, result = pcall(require, node)
return ok and result or nil
end
local participant = module('Shared/Participant')
local hostility = module('Shared/Combat/Hostility')
local merc = module('Client/Controllers/MercPlayerController')
local presenter = module('Client/Character/OperatorPresenter')
local pov = module('Client/Controllers/MercPOVController')
local gun = module('Client/Controllers/GunController')
local silhouettes = module('Shared/Weapons/WeaponSilhouette')
local units = module('Shared/Units')
local records, stopped = {}, false
local stats = { targets = 0, rendered = 0, errors = 0, adapter = adapter and adapter.name or 'OperatorPresenter', details = {} }
local overlay = Instance.new('ScreenGui')
overlay.Name, overlay.IgnoreGuiInset, overlay.ResetOnSpawn = 'NeverloseESP', true, false
overlay.DisplayOrder, overlay.ZIndexBehavior = 999, Enum.ZIndexBehavior.Sibling
overlay.Parent = localPlayer:WaitForChild('PlayerGui')
local function make(class, props, parent)
local o = Instance.new(class)
for k,v in pairs(props) do o[k] = v end
o.Parent = parent
return o
end
local function setting(ctx, path)
path = 'Players/' .. path
local v = Store.values[path .. '@' .. ctx]
if v == nil then v = Store.defaults[path] end
return v
end
local function color(ctx,path)
local s = tostring(setting(ctx,path .. '/Color') or 'FFFFFF'):gsub('#','')
return Color3.fromRGB(tonumber(s:sub(1,2),16) or 255,tonumber(s:sub(3,4),16) or 255,tonumber(s:sub(5,6),16) or 255)
end
local function body(owner)
return participant and participant.BodyOf(owner) or (owner:IsA('Player') and owner.Character or owner:FindFirstChildWhichIsA('Model'))
end
local function visual(owner)
local v = merc and merc.GetVisual(owner)
if not v and presenter then v = presenter.RigOf(owner) end
if not v and owner == localPlayer and pov and pov._state then v = pov._state.visual end
return v and v.Parent and v or nil
end
local function team(owner)
if hostility then return hostility.TeamOf(owner) end
return owner:GetAttribute('Team')
end
local function context(owner)
if owner == localPlayer then return 'Local' end
if hostility then return hostility.IsHostile(localPlayer,owner) and 'Enemies' or 'Teammates' end
local t = team(owner)
return t and t ~= 'Neutral' and t == team(localPlayer) and 'Teammates' or 'Enemies'
end
-- Text and line primitives. ESP text is Arial with a hard black outline, like the original.
local FONT, FONT_BOLD = Font.fromEnum(Enum.Font.Arial), Font.fromEnum(Enum.Font.ArialBold)
local BLACK, WHITE = Color3.new(0,0,0), Color3.new(1,1,1)
local function label(parent,size,bold)
return make('TextLabel',{BackgroundTransparency=1,BorderSizePixel=0,FontFace=bold and FONT_BOLD or FONT,TextSize=size or 12,TextColor3=WHITE,TextStrokeTransparency=0,TextStrokeColor3=BLACK,Text='',Visible=false},parent)
end
local function line(parent)
return make('Frame',{BorderSizePixel=0,BackgroundColor3=WHITE,AnchorPoint=Vector2.new(.5,.5),Visible=false},parent)
end
local function outlined(parent,c)
local f=make('Frame',{BackgroundTransparency=1,BorderSizePixel=0,Visible=false},parent)
local s=make('UIStroke',{Thickness=1,Color=c or BLACK},f)
pcall(function() s.BorderStrokePosition=Enum.BorderStrokePosition.Inner end)
return f,s
end
local function segment(o,a,b,c,thickness)
local d=b-a
o.Position=UDim2.fromOffset((a.X+b.X)/2,(a.Y+b.Y)/2)
o.Size=UDim2.fromOffset(d.Magnitude,thickness or 1)
o.Rotation=math.deg(math.atan2(d.Y,d.X))
o.BackgroundColor3, o.Visible=c,true
end
---------------------------------------------------------------------------------------
-- Chams
--
-- No Highlights and nothing in the world is made see-through. The operator rig is invisible
-- body-shaped chassis MeshParts with wrapped garment MeshParts on top. Two layers:
-- visible the real garments are recoloured in place (lit, shaded). The world hides them
-- behind walls by itself, so this layer is exact to the pixel.
-- hidden a copy of the rig lives in a ViewportFrame drawn above the world, painted in the
-- hidden colour. Its camera copies the real one every frame, and every frame it copies
-- the real joints' Transform (AnimationConstraint, Motor6D, Bone): the garments are
-- layered clothing that deform from those joints, so the pose matches exactly. The
-- weapon is placed by CFrame. The layer is clipped on screen to the walls that rays
-- from the camera actually hit, so it only covers the body where a wall is in front
-- of it and the two colours meet along the wall's edge.
---------------------------------------------------------------------------------------
-- all hidden layers share one container under the 2D overlay
local layers=make('Frame',{Name='HiddenLayers',Size=UDim2.fromScale(1,1),BackgroundTransparency=1,ZIndex=1},overlay)
local materials={Flat=Enum.Material.SmoothPlastic,Glow=Enum.Material.Neon,Metallic=Enum.Material.Metal,Glass=Enum.Material.Glass,Forcefield=Enum.Material.ForceField,Foil=Enum.Material.Foil,Marble=Enum.Material.Marble}
local LIT={Flat=true,Glow=true,Metallic=true,Foil=true,Marble=true,Glass=true,Forcefield=true}
-- One recipe for both the real parts and the copy.
local function surface(p,mode,c,opacity,baseTransparency)
for _,a in ipairs(p:GetChildren()) do if a:IsA('SurfaceAppearance') and a.Parent then a.Parent=nil end end
if p:IsA('MeshPart') and p.TextureID~='' then p.TextureID='' end
local m=materials[mode] or materials.Flat
local shade=mode=='Glow' and c:Lerp(BLACK,.3) or c
if p.Material~=m then p.Material=m end
if adapter then p.MaterialVariant='' end
if p.Color~=shade then p.Color=shade end
p.Reflectance=mode=='Metallic' and .35 or 0
local t=baseTransparency+(1-opacity)*(1-baseTransparency)
if mode=='Glass' then t=math.max(t,.55) end
if p.Transparency~=t then p.Transparency=t end
end
-- Remember a real surface the first time it is modified so it can be put back exactly.
local function saveSurface(r,p)
local s=r.surfaces[p]
if s then return s end
s={material=p.Material,variant=p.MaterialVariant,color=p.Color,reflectance=p.Reflectance,transparency=p.Transparency,appearances={}}
if p:IsA('MeshPart') then s.texture=p.TextureID end
for _,a in ipairs(p:GetChildren()) do
if a:IsA('SurfaceAppearance') then table.insert(s.appearances,a) end
end
r.surfaces[p]=s
return s
end
local function resetPart(r,p)
local s=r.surfaces[p]
if not s then return end
if p.Parent then
p.Material=s.material;p.MaterialVariant=s.variant or ''; p.Color=s.color; p.Reflectance=s.reflectance; p.Transparency=s.transparency
if s.texture~=nil then p.TextureID=s.texture end
for _,a in ipairs(s.appearances) do if a.Parent~=p then a.Parent=p end end
else
for _,a in ipairs(s.appearances) do a:Destroy() end
end
r.surfaces[p]=nil
end
local function restore(r)
if adapter and r.model then adapter.paintCosmetics(r.model,false)end
for p in pairs(r.surfaces) do resetPart(r,p) end
r.litSig=nil
end
-- Other characters standing in front are not walls: the one behind is simply covered.
local function isActor(inst)
for _,name in ipairs({'MercPlayers','MockPlayers','OperatorBots'}) do
local folder=workspace:FindFirstChild(name)
if folder and inst:IsDescendantOf(folder) then return true end
end
return false
end
-- The first solid thing between the camera and a point, if any. See-through helpers
-- (trigger volumes, invisible blockers) are skipped.
local function blocker(origin,target,base)
local dir=target-origin
local params,list=base,nil
for _=1,4 do
local hit=workspace:Raycast(origin,dir,params)
if not hit then return nil end
local inst=hit.Instance
if inst:IsA('Terrain') then return inst end
if not (inst.Transparency>=.95 or (not inst.CanCollide and inst.Transparency>=.2) or isActor(inst)) then return inst end
if not list then list=table.clone(base.FilterDescendantsInstances) end
table.insert(list,inst)
params=RaycastParams.new(); params.FilterType=Enum.RaycastFilterType.Exclude; params.FilterDescendantsInstances=list
end
return nil
end
local function rayParams(r)
local params=RaycastParams.new(); params.FilterType=Enum.RaycastFilterType.Exclude
local ignore=adapter and adapter.actorModels() or {r.model}
local b=body(r.owner)
if b then table.insert(ignore,b) end
if localPlayer.Character then table.insert(ignore,localPlayer.Character) end
if pov and pov._state and pov._state.visual then table.insert(ignore,pov._state.visual) end
params.FilterDescendantsInstances=ignore
return params
end
-- Rays to both sides and the centre of every body part. Whatever they hit is a wall in front
-- of the target; a wall stays on the list briefly after the last hit so edges do not flicker.
local function sampleBody(r,cam,now)
r.occTime=now
local origin,right,params=cam.CFrame.Position,cam.CFrame.RightVector,rayParams(r)
local hidden=0
for _,c in ipairs(r.chassis) do
local center=c.part.Position
local off=right*(c.part.Size.Magnitude*.2)
local any=false
for _,point in ipairs({center-off,center,center+off}) do
local hit=blocker(origin,point,params)
if hit then r.walls[hit]=now; any=true end
end
if any then hidden+=1 end
end
for wall,seen in pairs(r.walls) do if now-seen>.2 or not wall.Parent then r.walls[wall]=nil end end
r.visibility=#r.chassis>0 and 1-hidden/#r.chassis or 1
end
-- Sample the body-sized image in camera space. Each cell compares map depth
-- with the actual chassis hit, so disjoint walls do not paint the gap between them.
local function sampleMask(r,cam,now)
local box=r.maskBox
if not box then return end
local size=overlay.AbsoluteSize
local x0,y0=math.clamp(box[1],0,size.X),math.clamp(box[2],0,size.Y)
local x1,y1=math.clamp(box[3],0,size.X),math.clamp(box[4],0,size.Y)
if x1<=x0 or y1<=y0 then r.maskData=nil;return end
local cols=math.clamp(math.ceil((x1-x0)/10),4,12)
local rows=math.clamp(math.ceil((y1-y0)/10),6,18)
local include=RaycastParams.new();include.FilterType=Enum.RaycastFilterType.Include
local parts={};for _,c in ipairs(r.chassis) do if c.part.Parent then table.insert(parts,c.part) end end
include.FilterDescendantsInstances=parts
local exclude=rayParams(r)
local origin=cam.CFrame.Position
local depth=math.max(.1,(r.maskCenter-origin):Dot(cam.CFrame.LookVector))
local grid={};local hidden=0
table.clear(r.walls)
for y=1,rows do for x=1,cols do
local px=x0+(x-.5)*(x1-x0)/cols
local py=y0+(y-.5)*(y1-y0)/rows
local ray=cam:ViewportPointToRay(px,py)
local distance=depth/math.max(.05,ray.Direction:Dot(cam.CFrame.LookVector))
local bodyHit=workspace:Raycast(origin,ray.Direction*(distance+12),include)
if bodyHit then distance=(bodyHit.Position-origin).Magnitude end
local wall=blocker(origin,origin+ray.Direction*math.max(.01,distance-.04),exclude)
local covered=wall~=nil
grid[(y-1)*cols+x]=covered
if covered then hidden+=1;r.walls[wall]=now end
end end
local rects=OcclusionMask.rectangles(grid,cols,rows,4)
if hidden>0 and not r.hadMask then r.maskSince=now end
r.hadMask=hidden>0
r.maskData={cols=cols,rows=rows,rects=rects,box={x0,y0,x1,y1}}
r.visibility=1-hidden/(cols*rows)
r.maskRays=cols*rows*2
r.occTime=now
r.maskCamera=cam.CFrame
end
-- Screen rectangle covered by a wall (its box projected), or the whole screen when that cannot be
-- known (terrain, or a wall reaching behind the camera).
local function wallRect(cam,inst,size)
if not inst:IsA('BasePart') or inst:IsA('Terrain') then return 0,0,size.X,size.Y end
local cf,s=inst.CFrame,inst.Size/2
local x0,y0,x1,y1=math.huge,math.huge,-math.huge,-math.huge
for ix=-1,1,2 do for iy=-1,1,2 do for iz=-1,1,2 do
local q=cam:WorldToViewportPoint(cf:PointToWorldSpace(Vector3.new(s.X*ix,s.Y*iy,s.Z*iz)))
if q.Z<.05 then return 0,0,size.X,size.Y end
x0,y0,x1,y1=math.min(x0,q.X),math.min(y0,q.Y),math.max(x1,q.X),math.max(y1,q.Y)
end end end
return x0,y0,x1,y1
end
-- A layer is a clipped, full-screen ViewportFrame with a camera that copies the real one.
local function newLayer()
local clip=make('Frame',{Name='ChamsLayer',BackgroundTransparency=1,ClipsDescendants=true,Visible=false},layers)
local vp=make('ViewportFrame',{BackgroundTransparency=1,Ambient=Color3.fromRGB(128,132,145),LightColor=Color3.fromRGB(255,252,245)},clip)
local world=make('WorldModel',{},vp)
local cam=make('Camera',{},vp)
vp.CurrentCamera=cam
return {clip=clip,vp=vp,world=world,cam=cam}
end
local function showLayer(layer,cam,x0,y0,x1,y1,z)
local size=overlay.AbsoluteSize
layer.clip.Visible=true
layer.clip.Position,layer.clip.Size=UDim2.fromOffset(x0,y0),UDim2.fromOffset(x1-x0,y1-y0)
layer.clip.ZIndex=z
layer.vp.Position,layer.vp.Size=UDim2.fromOffset(-x0,-y0),UDim2.fromOffset(size.X,size.Y)
layer.cam.CFrame,layer.cam.FieldOfView=cam.CFrame,cam.FieldOfView
layer.vp.LightDirection=(cam.CFrame.LookVector*.45+cam.CFrame.RightVector*.25-Vector3.yAxis).Unit
end
-- Copies of the rig: r.clone sits in the hidden layer, r.frontClone in the front layer.
local function destroyClone(r)
r.maskData=nil;r.hadMask=false;r.maskSince=nil;r.maskCamera=nil;r.occTime=0
for _,entry in pairs(r.extraMasks or {}) do if entry.clone then entry.clone.model:Destroy() end;entry.layer.clip:Destroy() end
r.extraMasks={}
if r.clone then r.clone.model:Destroy() end
if r.frontClone then r.frontClone.model:Destroy() end
r.clone,r.frontClone=nil,nil
if r.layer then r.layer.clip.Visible=false end
if r.front then r.front.clip.Visible=false end
end
local function cloneRig(r,layer,hidden)
local ok,model=pcall(function() return r.model:Clone() end)
if not ok or not model then r.cloneRetry=os.clock()+1; return nil end
if adapter then
local collection=game:GetService('CollectionService')
local nodes=model:GetDescendants();table.insert(nodes,model)
for _,node in ipairs(nodes)do for _,tag in ipairs(collection:GetTags(node))do collection:RemoveTag(node,tag)end end
end
local c={model=model,joints={},bones={},rigid={},meshes={},map={}}
-- real and copied trees are matched by name, class and order among siblings
local function walk(a,b)
local buckets={}
for _,x in ipairs(a:GetChildren()) do
local k=x.Name..'|'..x.ClassName
buckets[k]=buckets[k] or {}
table.insert(buckets[k],x)
end
local seen={}
for _,y in ipairs(b:GetChildren()) do
local k=y.Name..'|'..y.ClassName
seen[k]=(seen[k] or 0)+1
local x=buckets[k] and buckets[k][seen[k]]
if not x or y:IsA('LuaSourceContainer') or y:IsA('Sound') or y:IsA('ParticleEmitter') or y:IsA('Highlight') or y:IsA('BillboardGui') or y:IsA('Light') then
y:Destroy()
else
if y:IsA('AnimationConstraint') or y:IsA('Motor6D') then table.insert(c.joints,{x,y})
elseif y:IsA('Bone') then table.insert(c.bones,{x,y})
elseif adapter and y:IsA('SpecialMesh') then table.insert(c.meshes,{x,y})
elseif y:IsA('BasePart') then
c.map[x]=y
y.CanCollide,y.CanQuery,y.CanTouch,y.CastShadow=false,false,false,false
end
walk(x,y)
end
end
end
walk(r.model,model)
if adapter and hidden~=false then adapter.paintCosmetics(model,true,true)end
c.root=model:FindFirstChild('HumanoidRootPart') or model.PrimaryPart
c.realRoot=r.model:FindFirstChild('HumanoidRootPart') or r.model.PrimaryPart
if not (c.root and c.realRoot) then model:Destroy(); r.cloneRetry=os.clock()+1; return nil end
-- The weapon (anything nested below the rig) is placed by the game directly, not through the
-- skeleton, so its parts follow the real ones by CFrame and lose their welds.
local rigid={}
for x,y in pairs(c.map) do
if adapter or x.Parent~=r.model then rigid[y]=true; table.insert(c.rigid,{x,y}) end
y.Anchored=y==c.root or rigid[y]==true
end
for _,d in ipairs(model:GetDescendants()) do
local a,b
if d:IsA('JointInstance') or d:IsA('WeldConstraint') then a,b=d.Part0,d.Part1
elseif d:IsA('AnimationConstraint') then a,b=d.Attachment0 and d.Attachment0.Parent,d.Attachment1 and d.Attachment1.Parent end
if (a and rigid[a]) or (b and rigid[b]) then d:Destroy() end
end
for i=#c.joints,1,-1 do if not c.joints[i][2].Parent then table.remove(c.joints,i) end end
local hum=model:FindFirstChildOfClass('Humanoid')
if hum then hum.EvaluateStateMachine=false; hum.DisplayDistanceType=Enum.HumanoidDisplayDistanceType.None end
model.Parent=layer.world
return c
end
local function buildClone(r)
if r.clone then r.clone.model:Destroy(); r.clone=nil end
r.layer=r.layer or newLayer()
r.clone=cloneRig(r,r.layer)
r.cloneSig=nil
end
local function poseClone(c)
if c.realRoot.Parent then c.root.CFrame=c.realRoot.CFrame end
for _,j in ipairs(c.joints) do
j[2].Transform=j[1].Transform
if adapter and j[1]:IsA('Motor6D') then j[2].C0=j[1].C0;j[2].C1=j[1].C1
elseif adapter and j[1]:IsA('AnimationConstraint') then
for _,key in ipairs({'Attachment0','Attachment1'})do if j[1][key] and j[2][key]then j[2][key].CFrame=j[1][key].CFrame end end
end
end
for _,b in ipairs(c.bones) do b[2].Transform=b[1].Transform end
for _,w in ipairs(c.rigid) do w[2].CFrame=w[1].CFrame;if adapter and w[2].Size~=w[1].Size then w[2].Size=w[1].Size end end
for _,mesh in ipairs(c.meshes or {})do mesh[2].Scale=mesh[1].Scale;mesh[2].Offset=mesh[1].Offset end
end
local function chamsOff(r)
restore(r)
destroyClone(r)
table.clear(r.walls)
end
local function destroy(r)
for _,c in ipairs(r.modelConnections or {}) do c:Disconnect() end
chamsOff(r)
if r.layer then r.layer.clip:Destroy() end
if r.front then r.front.clip:Destroy() end
r.ui:Destroy()
end
local function updateChams(r,ctx,cam,now,detail,onScreen,dead)
local function get(p) return setting(ctx,p) end
local visibleOn=get('Chams/Visible')==true
local hiddenOn=get('Chams/Through Walls')==true
local mode=get('Chams/Material') or 'Flat'
if not LIT[mode] then mode='Flat' end
local opacity=math.clamp((tonumber(get('Chams/Opacity')) or 100)/100,.1,1)
local visibleColor,hiddenColor=color(ctx,'Chams/Visible'),color(ctx,'Chams/Through Walls')
detail.chams={mode=mode,visible=visibleOn,hidden=hiddenOn}
r.hiddenRect=nil
r.chamsOn=visibleOn or hiddenOn
if not r.chamsOn then chamsOff(r); return end
-- hidden layer; a ragdoll is driven by physics, not joints, so it only gets the visible layer
local hiddenLayer=hiddenOn and not dead and #r.chassis>0
if hiddenLayer then
if r.clone and r.cloneDirty and now-(r.topologyTime or 0)>.3 then destroyClone(r) end
if not r.clone and now>=(r.cloneRetry or 0) then buildClone(r); r.cloneDirty=false; r.litSig=nil end
elseif r.clone then destroyClone(r); table.clear(r.walls) end
-- visible layer: the real garments
local sig=mode..'|'..visibleColor:ToHex()..'|'..opacity
if visibleOn then
if sig~=r.litSig or r.litDirty then
if adapter then adapter.paintCosmetics(r.model,true,true)end
r.litSig,r.litDirty=sig,false
for _,p in ipairs(r.parts) do
if p.Parent then surface(p,mode,visibleColor,opacity,saveSurface(r,p).transparency) end
end
end
elseif next(r.surfaces) then restore(r) end
if adapter and visibleOn then adapter.paintCosmetics(r.model,true,false)end
local c=r.clone
if c then
local layer=r.layer
if onScreen then
local moved=not r.maskCamera or (cam.CFrame.Position-r.maskCamera.Position).Magnitude>.08 or cam.CFrame.LookVector:Dot(r.maskCamera.LookVector)<.99998
local old=r.maskData and r.maskData.box;local box=r.maskBox
local actorMoved=old and box and (math.abs(old[1]-box[1])>1 or math.abs(old[2]-box[2])>1 or math.abs(old[3]-box[3])>1 or math.abs(old[4]-box[4])>1)
if moved or actorMoved or now-r.occTime>=.066 then sampleMask(r,cam,now) end
end
layer.clip.Visible=false
for _,entry in pairs(r.extraMasks or {}) do
entry.layer.clip.Visible=false
if entry.clone and now-(entry.used or now)>2 then entry.clone.model:Destroy();entry.clone=nil;entry.signature=nil end
end
local data=r.maskData
-- Keep tested regions in the screen coordinates that were actually raycast.
-- Retiling an old mask to a moving body would drag hidden color across a wall edge.
local box=data and data.box
local show=onScreen and data and box and #data.rects>0
detail.walls=0;for _ in pairs(r.walls) do detail.walls+=1 end
detail.maskRegions=show and #data.rects or 0
detail.occlusionRays=r.maskRays or 0
if show then
local size=overlay.AbsoluteSize
local bx0,by0=math.clamp(box[1],0,size.X),math.clamp(box[2],0,size.Y)
local bx1,by1=math.clamp(box[3],0,size.X),math.clamp(box[4],0,size.Y)
local hsig=mode..'|'..hiddenColor:ToHex()..'|'..opacity
local union=nil
for index,rect in ipairs(data.rects) do
local activeLayer,activeClone,signature=layer,c,r.cloneSig
if index>1 then
r.extraMasks=r.extraMasks or {}
local entry=r.extraMasks[index]
if not entry then entry={layer=newLayer()};r.extraMasks[index]=entry end
entry.used=now
if not entry.clone and now>=(entry.retry or 0) then entry.clone=cloneRig(r,entry.layer);if not entry.clone then entry.retry=now+.5 end end
activeLayer,activeClone,signature=entry.layer,entry.clone,entry.signature
end
if activeClone then
local x0=math.floor(bx0+(rect[1]-1)*(bx1-bx0)/data.cols)
local y0=math.floor(by0+(rect[2]-1)*(by1-by0)/data.rows)
local x1=math.ceil(bx0+rect[3]*(bx1-bx0)/data.cols)
local y1=math.ceil(by0+rect[4]*(by1-by0)/data.rows)
showLayer(activeLayer,cam,x0,y0,x1,y1,8001-2*math.min(math.floor(r.dist),4000))
-- A short opacity entrance softens visibility changes without interpolating pose.
activeLayer.vp.ImageTransparency=1-math.clamp((now-(r.maskSince or now))/.08,0,1)
poseClone(activeClone)
if signature~=hsig then
for _,p in ipairs(r.parts) do
local copy=activeClone.map[p]
if copy then surface(copy,mode,hiddenColor,opacity,(r.surfaces[p] and r.surfaces[p].transparency) or p.Transparency) end
end
if index==1 then r.cloneSig=hsig else r.extraMasks[index].signature=hsig end
end
union=union and {math.min(union[1],x0),math.min(union[2],y0),math.max(union[3],x1),math.max(union[4],y1)} or {x0,y0,x1,y1}
end
end
r.hiddenRect=union
end
detail.chamsMethod='RigMaterial+ViewportHidden'
else
detail.chamsMethod='RigMaterial'
end
detail.visibility=r.visibility
end
local function newRecord(owner)
local r={owner=owner,bones={},parts={},boxParts={},surfaces={},walls={},chassis={},lastScan=0,lastStep=0,lastSeen=0,occTime=0,dist=0}
r.ui=make('Frame',{Name=owner.Name,Size=UDim2.fromScale(1,1),BackgroundTransparency=1,Visible=false,ZIndex=2},overlay)
r.boxOuter=outlined(r.ui,BLACK); r.box,r.boxStroke=outlined(r.ui,WHITE); r.boxInner=outlined(r.ui,BLACK)
r.modelConnections={}
r.name=label(r.ui,13); r.weapon=label(r.ui,12); r.hpText=label(r.ui,10,true)
r.flags={}
for i=1,7 do r.flags[i]=label(r.ui,10,true) end
r.icon=make('ImageLabel',{BackgroundTransparency=1,Visible=false,ScaleType=Enum.ScaleType.Fit},r.ui)
r.health=make('Frame',{BorderSizePixel=0,BackgroundColor3=BLACK,Visible=false},r.ui)
r.healthFill=make('Frame',{BorderSizePixel=0,AnchorPoint=Vector2.new(0,1),Position=UDim2.new(0,1,1,-1)},r.health)
r.ammo=make('Frame',{BorderSizePixel=0,BackgroundColor3=BLACK,Visible=false},r.ui)
r.ammoFill=make('Frame',{BorderSizePixel=0,Position=UDim2.fromOffset(1,1)},r.ammo)
r.arrow=label(r.ui,22); r.arrow.Text=utf8.char(9650); r.arrow.TextXAlignment=Enum.TextXAlignment.Center
r.ring=make('Frame',{AnchorPoint=Vector2.new(.5,.5),BackgroundTransparency=1,Visible=false},r.ui)
make('UICorner',{CornerRadius=UDim.new(1,0)},r.ring)
r.ringStroke=make('UIStroke',{Thickness=2},r.ring)
r.weaponView=make('ViewportFrame',{BackgroundTransparency=1,Visible=false,Ambient=WHITE,LightColor=BLACK},r.ui)
-- glow: concentric rings around the box, so the player's own model is never tinted
r.aura={}
for i=1,4 do
local f,st=outlined(r.ui,WHITE)
st.Thickness=3
make('UICorner',{CornerRadius=UDim.new(0,3+i*2)},f)
r.aura[i]={f=f,s=st}
end
records[owner]=r
return r
end
-- Only anatomical joints from the driving skeleton belong in the overlay.
-- Clothing meshes can carry duplicates and helper bones far outside the body.
local aliases={
Head={'head'}, Chest={'uppertorso','spine2','upperchest','chest','spine1','spine','torso'},
Hips={'hips','pelvis','lowertorso'},
LShoulder={'leftarm','leftupperarm','lupperarm'}, LElbow={'leftforearm','leftlowerarm','lforearm'}, LHand={'lefthand','lhand'},
RShoulder={'rightarm','rightupperarm','rupperarm'}, RElbow={'rightforearm','rightlowerarm','rforearm'}, RHand={'righthand','rhand'},
LHip={'leftupleg','leftupperleg','lthigh'}, LKnee={'leftleg','leftlowerleg','lcalf'}, LFoot={'leftfoot','lfoot'},
RHip={'rightupleg','rightupperleg','rthigh'}, RKnee={'rightleg','rightlowerleg','rcalf'}, RFoot={'rightfoot','rfoot'},
}
local links={{'Head','Chest'},{'Chest','Hips'},
{'Chest','LShoulder'},{'LShoulder','LElbow'},{'LElbow','LHand'},
{'Chest','RShoulder'},{'RShoulder','RElbow'},{'RElbow','RHand'},
{'Hips','LHip'},{'LHip','LKnee'},{'LKnee','LFoot'},
{'Hips','RHip'},{'RHip','RKnee'},{'RKnee','RFoot'}}
-- The 2D box follows the body, not the arms or the weapon, so it stays put while aiming.
local boxNames={Head=true,UpperTorso=true,LowerTorso=true,LeftUpperLeg=true,RightUpperLeg=true,LeftLowerLeg=true,RightLowerLeg=true,LeftFoot=true,RightFoot=true}
local function normalized(name)
return name:lower():gsub('^.*:', ''):gsub('mixamorig',''):gsub('[^%a%d]','')
end
local function worldPosition(node)
if node:IsA('Bone') then return node.TransformedWorldCFrame.Position end
if node:IsA('Attachment') then return node.WorldPosition end
return node.Position
end
local function resetModel(r,v)
for _,c in ipairs(r.modelConnections) do c:Disconnect() end
table.clear(r.modelConnections)
restore(r)
destroyClone(r)
r.model=v; r.scanDirty=true; r.joints={}; r.parts={}; r.boxParts={}; r.chassis={}; r.occTime=0; r.cloneDirty=false; r.cloneRetry=nil; table.clear(r.walls)
if v then
local function topologyChanged(node)
-- Footstep sounds, emitters and removed textures do not change the rig.
if node:IsA('BasePart') or node:IsA('Bone') or node:IsA('WrapLayer') or node:IsA('WrapTarget') or node:IsA('Motor6D') or node:IsA('AnimationConstraint') or adapter and (node:IsA('Shirt')or node:IsA('Pants')or node:IsA('ShirtGraphic')or node:IsA('SpecialMesh')or node:IsA('Decal')) then
r.scanDirty=true; r.litDirty=true; r.cloneDirty=true; r.topologyTime=os.clock()
end
end
table.insert(r.modelConnections,v.DescendantAdded:Connect(topologyChanged))
table.insert(r.modelConnections,v.DescendantRemoving:Connect(topologyChanged))
end
if #r.bones==0 then
for _,pair in ipairs(links) do table.insert(r.bones,{keys=pair,line=line(r.ui)}) end
end
end
local function scan(r,now)
if not r.scanDirty then return end
r.scanDirty=false
r.joints,r.parts,r.boxParts,r.chassis={},{},{},{}
local byName={}
-- Prefer the skeleton below the root to any copies in garment MeshParts.
local root=r.model.PrimaryPart or r.model:FindFirstChild('RootPart')
local driving=root and root:GetDescendants() or {}
for _,node in ipairs(driving) do
if node:IsA('Bone') then byName[normalized(node.Name)]=node end
end
for _,node in ipairs(r.model:GetDescendants()) do
if node:IsA('Bone') or node:IsA('BasePart') then
local key=normalized(node.Name)
if not byName[key] then byName[key]=node end
end
-- lenses and other see-through parts keep their own look under chams
local saved=r.surfaces[node]
if node:IsA('BasePart') and (saved and saved.transparency or node.Transparency)<.1 then table.insert(r.parts,node) end
end
for _,node in ipairs(r.model:GetChildren()) do
if node:IsA('BasePart') then
if boxNames[node.Name] then table.insert(r.boxParts,node) end
-- the invisible body parts under the clothes are what the rays aim at
if node:IsA('MeshPart') and node.Name~='HumanoidRootPart' and node.Transparency>=.99 then
table.insert(r.chassis,{part=node})
end
end
end
if adapter then r.chassis=adapter.chassis(r.owner) end
for key,names in pairs(aliases) do
for _,name in ipairs(names) do if byName[name] then r.joints[key]=byName[name]; break end end
end
end
-- Clip a segment to the camera near plane before projection, then to the viewport.
local function projectSegment(cam,a,b)
local ac,bc=cam.CFrame:PointToObjectSpace(a),cam.CFrame:PointToObjectSpace(b)
local near=.1
if ac.Z>-near and bc.Z>-near then return nil end
if ac.Z>-near then a=a:Lerp(b,(-near-ac.Z)/(bc.Z-ac.Z))
elseif bc.Z>-near then b=b:Lerp(a,(-near-bc.Z)/(ac.Z-bc.Z)) end
local pa,pb=cam:WorldToViewportPoint(a),cam:WorldToViewportPoint(b)
local x,y,dx,dy=pa.X,pa.Y,pb.X-pa.X,pb.Y-pa.Y
local lo,hi=0,1
local function clip(p,q)
if math.abs(p)<1e-6 then return q>=0 end
local t=q/p
if p<0 then if t>hi then return false end; lo=math.max(lo,t)
else if t<lo then return false end; hi=math.min(hi,t) end
return true
end
local size=cam.ViewportSize
if not (clip(-dx,x) and clip(dx,size.X-x) and clip(-dy,y) and clip(dy,size.Y-y)) then return nil end
return Vector2.new(x+dx*lo,y+dy*lo),Vector2.new(x+dx*hi,y+dy*hi)
end
local function datum(owner,b,names)
if adapter then local value=adapter.datum(owner,names);if value~=nil then return value end end
for _,n in ipairs(names) do
local v=owner:GetAttribute(n)
if v==nil and b then v=b:GetAttribute(n) end
if v~=nil then return v end
end
return nil
end
-- World-aligned box around the body parts, padded a little, projected to the screen.
local function worldBox(parts)
local lo,hi
for _,part in ipairs(parts) do
if part.Parent then
local cf,s=part.CFrame,part.Size/2
for ix=-1,1,2 do for iy=-1,1,2 do for iz=-1,1,2 do
local p=cf:PointToWorldSpace(Vector3.new(s.X*ix,s.Y*iy,s.Z*iz))
if lo then lo=Vector3.new(math.min(lo.X,p.X),math.min(lo.Y,p.Y),math.min(lo.Z,p.Z)); hi=Vector3.new(math.max(hi.X,p.X),math.max(hi.Y,p.Y),math.max(hi.Z,p.Z))
else lo,hi=p,p end
end end end
end
end
return lo,hi
end
local function projectBox(cam,lo,hi)
local mn,mx=Vector2.new(math.huge,math.huge),Vector2.new(-math.huge,-math.huge)
local count=0
for ix=0,1 do for iy=0,1 do for iz=0,1 do
local q=cam:WorldToViewportPoint(Vector3.new(ix==0 and lo.X or hi.X,iy==0 and lo.Y or hi.Y,iz==0 and lo.Z or hi.Z))
if q.Z>.1 then
count+=1
mn=Vector2.new(math.min(mn.X,q.X),math.min(mn.Y,q.Y)); mx=Vector2.new(math.max(mx.X,q.X),math.max(mx.Y,q.Y))
end
end end end
return mn,mx,count
end
local function showText(o,value,x,y,w,c)
o.Text=tostring(value); o.Position=UDim2.fromOffset(x,y); o.Size=UDim2.fromOffset(w,o.TextSize+4)
o.TextColor3=c or WHITE; o.Visible=true
end
local flagStyle={Aiming={'AIM',Color3.fromRGB(255,205,100)},Credits={'$',Color3.fromRGB(135,225,115)},['Local Ping']={'MS',Color3.fromRGB(255,130,130)},Distance={'M',Color3.fromRGB(190,200,215)}}
local function render(r,cam,dt,now)
r.ui.Visible=false
local owner=r.owner
local detail={name=owner.Name,reason='no visual'}
stats.details[owner.Name]=detail
local v=visual(owner)
if v~=r.model then resetModel(r,v) end
if not v then chamsOff(r); return end
local ctx=context(owner)
detail.context=ctx
local function get(p) return setting(ctx,p) end
local b=body(owner)
local hum=b and b:FindFirstChildOfClass('Humanoid')
local hp=tonumber(datum(owner,b,{'BotHealth','Health'})) or (hum and hum.Health)
local maxHp=tonumber(datum(owner,b,{'BotMaxHealth','MaxHealth'})) or (hum and hum.MaxHealth)
local dead=datum(owner,b,{'Dead'})==true or (hp and hp<=0) or v:GetAttribute('Dead')==true or v:GetAttribute('Ragdolled')==true
if dead and not get('Chams/Ragdolls') then chamsOff(r); detail.reason='dead'; return end
local proxyRoot=b and (b:FindFirstChild('HumanoidRootPart') or b.PrimaryPart)
if owner==localPlayer then
if adapter and adapter.firstPerson(owner) then
local changed=next(r.surfaces)~=nil
chamsOff(r)
if changed then adapter.restoreVisibility(owner)end
detail.reason='first person self';return
end
local head=b and b:FindFirstChild('Head')
local anchor=head or proxyRoot
if (pov and pov._state and pov._state.visual==v) or (anchor and (cam.CFrame.Position-anchor.Position).Magnitude<2.5) then
chamsOff(r); detail.reason='first person self'; return
end
end
scan(r,now)
local points,positions={},{}
for key,node in pairs(r.joints) do
if node.Parent then
local p=worldPosition(node)
if p.X==p.X and p.Y==p.Y and p.Z==p.Z then positions[key]=p; table.insert(points,p) end
end
end
detail.joints=#points
if #points<4 then
chamsOff(r); detail.reason='waiting for driving skeleton'; return
end
local center=positions.Hips or positions.Chest or points[1]
r.dist=(center-cam.CFrame.Position).Magnitude
detail.distance=r.dist
r.ui.Visible=true
for _,o in ipairs({r.boxOuter,r.box,r.boxInner,r.name,r.weapon,r.hpText,r.icon,r.weaponView,r.health,r.ammo,r.arrow,r.ring}) do o.Visible=false end
for _,f in ipairs(r.flags) do f.Visible=false end
for _,a in ipairs(r.aura) do a.f.Visible=false end
for _,bone in ipairs(r.bones) do bone.line.Visible=false end
local viewport=cam.ViewportSize
local mn,mx,count
if #r.boxParts>=4 then
local lo,hi=worldBox(r.boxParts)
-- breathing room: a little above the helmet and below the boots, never thinner than a shoulder
local pad=Vector3.new(.15,.12,.15)
lo,hi=lo-pad,hi+pad
local cx,cz=(lo.X+hi.X)/2,(lo.Z+hi.Z)/2
local hx,hz=math.max((hi.X-lo.X)/2*.88,.95),math.max((hi.Z-lo.Z)/2*.88,.95)
mn,mx,count=projectBox(cam,Vector3.new(cx-hx,lo.Y,cz-hz),Vector3.new(cx+hx,hi.Y+.1,cz+hz))
else
mn,mx,count=Vector2.new(math.huge,math.huge),Vector2.new(-math.huge,-math.huge),0
local right,up=cam.CFrame.RightVector,cam.CFrame.UpVector
local scale=positions.Head and positions.Hips and math.clamp((positions.Head-positions.Hips).Magnitude/2.4,.25,4) or 1
for key,p in pairs(positions) do
local radius=(key=='Head' and .4 or (key=='Chest' or key=='Hips') and .32 or .18)*scale
for _,offset in ipairs({right*radius+up*radius,-right*radius-up*radius,right*radius-up*radius,-right*radius+up*radius}) do
local q=cam:WorldToViewportPoint(p+offset)
if q.Z>.1 then count+=1; mn=Vector2.new(math.min(mn.X,q.X),math.min(mn.Y,q.Y)); mx=Vector2.new(math.max(mx.X,q.X),math.max(mx.Y,q.Y)) end
end
end
end
local onScreen=count>0 and mx.X>=0 and mx.Y>=0 and mn.X<=viewport.X and mn.Y<=viewport.Y
-- a chams failure must not take the 2D overlay down with it
r.screenBox=nil
r.maskCenter=center
r.maskBox=onScreen and {mn.X-(mx.X-mn.X)*.2,mn.Y,mx.X+(mx.X-mn.X)*.2,mx.Y} or nil
local okChams,errChams=pcall(updateChams,r,ctx,cam,now,detail,onScreen,dead)
if not okChams then
chamsOff(r); stats.errors+=1; detail.chamsError=tostring(errChams)
if stats.lastError~=tostring(errChams) then stats.lastError=tostring(errChams); warn('[Neverlose for RIVALS ESP] chams: '..tostring(errChams)) end
end
if not onScreen then
detail.reason='off screen'
if get('Other/Out of FOV Arrows') then
local p=cam.CFrame:PointToObjectSpace(center)
local direction=Vector2.new(p.X,-p.Y)
if direction.Magnitude<.001 then direction=Vector2.new(0,1) end
direction=direction.Unit
local radius=math.min(viewport.X,viewport.Y)*.4
local at=viewport/2+direction*radius
showText(r.arrow,utf8.char(9650),at.X-14,at.Y-14,28,color(ctx,'Other/Out of FOV Arrows'))
r.arrow.Size=UDim2.fromOffset(28,28); r.arrow.Rotation=math.deg(math.atan2(direction.Y,direction.X))+90
r.arrow.TextTransparency=math.clamp((r.dist-60)/240,0,.55)
end
return
end
local x,y=math.floor(mn.X+.5),math.floor(mn.Y+.5)
local w,h=math.max(math.floor(mx.X-mn.X+.5),6),math.max(math.floor(mx.Y-mn.Y+.5),10)
x,y=math.clamp(x,-3000,3000),math.clamp(y,-3000,3000); w,h=math.min(w,6000),math.min(h,6000)
detail.reason=dead and 'ragdoll' or 'drawn'
detail.bounds={x=x,y=y,width=w,height=h}
if r.chamsOn then r.screenBox={x,y,w,h} end
if dead then return end
stats.rendered+=1
if get('ESP/Bounding Box')==true then
r.boxOuter.Visible,r.box.Visible,r.boxInner.Visible=true,true,true
r.boxOuter.Position,r.boxOuter.Size=UDim2.fromOffset(x-1,y-1),UDim2.fromOffset(w+2,h+2)
r.box.Position,r.box.Size=UDim2.fromOffset(x,y),UDim2.fromOffset(w,h)
r.boxInner.Position,r.boxInner.Size=UDim2.fromOffset(x+1,y+1),UDim2.fromOffset(math.max(w-2,0),math.max(h-2,0))
r.boxStroke.Color=color(ctx,'ESP/Bounding Box')
end
if get('Glow/Enabled') then
local gc,style=color(ctx,'Glow/Enabled'),get('Glow/Style')
local pulse=.5+.5*math.sin(now*3.2)
for i,a in ipairs(r.aura) do
local pad=2+i*3
a.f.Visible=true
a.f.Position=UDim2.fromOffset(x-pad,y-pad); a.f.Size=UDim2.fromOffset(w+pad*2,h+pad*2)
a.s.Color=gc
local base=style=='Outline' and (i==1 and .1 or i==2 and .55 or 1) or (.5+i*.11)
a.s.Transparency=style=='Pulse' and math.clamp(base+(1-pulse)*.4,0,1) or base
end
end
if get('ESP/Name') then showText(r.name,participant and participant.NameOf(owner) or owner.Name,x-60,y-20,w+120,color(ctx,'ESP/Name')); r.name.TextXAlignment=Enum.TextXAlignment.Center end
if get('ESP/Health Bar') and hp and maxHp and maxHp>0 then
local ratio=hp==math.huge and 1 or math.clamp(hp/maxHp,0,1)
local fillH=math.floor((h)*ratio+.5)
r.health.Visible=true; r.health.Position=UDim2.fromOffset(x-8,y-1); r.health.Size=UDim2.fromOffset(5,h+2)
r.healthFill.Size=UDim2.new(1,-2,0,fillH); r.healthFill.BackgroundColor3=Color3.fromRGB(235,70,70):Lerp(Color3.fromRGB(90,225,110),ratio)
if ratio<.995 then showText(r.hpText,math.ceil(hp),x-38,y+h-fillH-6,26); r.hpText.TextXAlignment=Enum.TextXAlignment.Right end
end
local weapon=datum(owner,b,{'CurrentWeapon'})
local ammo=tonumber(datum(owner,b,{'Ammo','CurrentAmmo','MagazineAmmo'}))
local capacity=tonumber(datum(owner,b,{'MaxAmmo','MagazineSize'}))
if owner==localPlayer and gun and gun.Weapon then
local state=gun.Weapon
ammo=tonumber(state.MagAmmo) or ammo
capacity=tonumber(state.MaxMagSize) or capacity
weapon=state.Name or weapon
end
local bottom=y+h+3
if get('ESP/Ammo') and ammo and capacity and capacity>0 then
r.ammo.Visible=true; r.ammo.Position=UDim2.fromOffset(x-1,bottom); r.ammo.Size=UDim2.fromOffset(w+2,5)
r.ammoFill.Size=UDim2.new(math.clamp(ammo/capacity,0,1),math.clamp(ammo/capacity,0,1)>0 and -2 or 0,1,-2); r.ammoFill.BackgroundColor3=color(ctx,'ESP/Ammo'); bottom+=7
end
local mode=get('ESP/Weapon')
if weapon and weapon~='' and mode~='Disabled' then
if mode=='Icon' or mode=='Text + Icon' then
if adapter then
r.icon.Image=adapter.weaponIcon(weapon) or '';r.icon.Visible=r.icon.Image~=''
r.icon.Position=UDim2.fromOffset(math.floor(x+w/2-28),bottom);r.icon.Size=UDim2.fromOffset(56,22)
if r.icon.Visible then bottom=bottom+23 end
else
if r.iconWeapon~=weapon then
r.iconWeapon=weapon; r.weaponView.CurrentCamera=nil; r.weaponView:ClearAllChildren()
-- the baked world model is the whole gun (the gunsmith model is only a stub); it stacks every
-- attachment variant, so keep one per slot and draw it as a flat white silhouette
local assets=RS:FindFirstChild('Assets')
local baked=assets and assets:FindFirstChild('WorldModelsBaked')
local source=baked and baked:FindFirstChild(weapon)
if source and source:IsA('Model') then
local clone=source:Clone()
local all=clone:FindFirstChild('AllAttachments')
if all then
for _,slot in ipairs(all:GetChildren()) do
for i,variant in ipairs(slot:GetChildren()) do if i>1 then variant:Destroy() end end
end
end
for _,d in ipairs(clone:GetDescendants()) do
if d:IsA('Sound') then d.PlayOnRemove=false; d:Destroy()
elseif d:IsA('LuaSourceContainer') or d:IsA('ParticleEmitter') or d:IsA('Light') or d:IsA('SurfaceAppearance') or d:IsA('Decal') then d:Destroy()
elseif d:IsA('BasePart') then
d.Anchored,d.Color,d.Material=true,WHITE,Enum.Material.SmoothPlastic
if d:IsA('MeshPart') then d.TextureID='' end
end
end
clone.Parent=r.weaponView
local cf,size=clone:GetBoundingBox()
local camera=make('Camera',{FieldOfView=25},r.weaponView)
local direction=silhouettes and silhouettes.View(weapon).LookVector or Vector3.new(1,0,0)
camera.CFrame=CFrame.lookAt(cf.Position-direction*math.max(size.Magnitude*1.4,1),cf.Position)
r.weaponView.CurrentCamera=camera
end
end
if r.weaponView.CurrentCamera~=nil then
r.weaponView.Visible=true
r.weaponView.Position=UDim2.fromOffset(math.floor(x+w/2-30),bottom-1)
r.weaponView.Size=UDim2.fromOffset(60,22); bottom+=21
end
end
end
if mode=='Text' or mode=='Text + Icon' then showText(r.weapon,weapon,x-60,bottom-1,w+120); r.weapon.TextXAlignment=Enum.TextXAlignment.Center end
end
local rows=0
local function flag(text,c)
rows+=1
local o=r.flags[rows]
if o then showText(o,text,x+w+5,y+(rows-1)*11-1,90,c); o.TextXAlignment=Enum.TextXAlignment.Left end
end
for _,name in ipairs(get('ESP/Flags') or {}) do
local style=flagStyle[name]
if name=='Aiming' and datum(owner,b,{'OwnAiming','Aiming'})==true then flag(style[1],style[2])
elseif name=='Credits' then local n=datum(owner,b,{'Money','MatchIC'}); if n then flag(tostring(n)..' IC',style[2]) end
elseif name=='Local Ping' then local n=tonumber(datum(owner,b,{'Ping'})); if not n and owner==localPlayer then n=localPlayer:GetNetworkPing()*2000 end; if n then flag(math.floor(n)..' '..style[1],style[2]) end
elseif name=='Distance' then
local m=units and units.StudsToMeters and units.StudsToMeters(r.dist) or r.dist*.28
flag(math.floor(m+.5)..style[1],style[2])
end
end
if dormant then flag('DORMANT',Color3.fromRGB(190,190,190)) end
if get('ESP/Skeleton') then
for _,bone in ipairs(r.bones) do
local a,c=positions[bone.keys[1]],positions[bone.keys[2]]
if a and c then
local pa,pb=projectSegment(cam,a,c)
if pa then segment(bone.line,pa,pb,color(ctx,'ESP/Skeleton')) end
end
end
end
if get('Other/Footstep Indicators') and proxyRoot then
local moving=r.lastPosition and (proxyRoot.Position-r.lastPosition).Magnitude/math.max(dt,.001)>2
r.lastPosition=proxyRoot.Position
if moving and now-r.lastStep>.4 then r.lastStep=now end
local age=now-r.lastStep
if age<.4 then
r.ring.Visible=true; r.ring.Position=UDim2.fromOffset(x+w/2,y+h); r.ring.Size=UDim2.fromOffset(20+age*100,8+age*30)
r.ringStroke.Color=color(ctx,'Other/Footstep Indicators'); r.ringStroke.Transparency=age/.4
end
end
end
local lastDiscover=0
-- The game's presenter uses RenderStepped connections, so subscribe after it
-- instead of running in an earlier BindToRenderStep pass with the previous pose.
local function renderFrame(dt)
if stopped then return end
local cam=workspace.CurrentCamera
if not cam then overlay.Enabled=false; for _,r in pairs(records) do chamsOff(r) end; return end
overlay.Enabled=true
local now=os.clock()
local started=now
if now-lastDiscover>.25 then
lastDiscover=now
local all=participant and participant.All() or Players:GetPlayers()
local seen={}
for _,owner in ipairs(all) do
seen[owner]=true
if not records[owner] then
local ok,err=pcall(newRecord,owner)
if not ok then stats.errors+=1; stats.lastError=tostring(err) end
end
end
for owner,r in pairs(records) do if not seen[owner] then destroy(r); records[owner]=nil end end
stats.targets=#all
end
stats.rendered=0
stats.chamsTargets=0
stats.details={}
for _,r in pairs(records) do
local ok,err=pcall(render,r,cam,dt,now)
if not ok then
r.ui.Visible=false; chamsOff(r)
stats.errors+=1
if stats.lastError~=tostring(err) then stats.lastError=tostring(err); warn('[Neverlose for RIVALS ESP] '..tostring(err)) end
end
if ok and (r.clone or next(r.surfaces)) then stats.chamsTargets+=1 end
end
-- A target that stands in front of a farther target's hidden layer is drawn once more, as it
-- looks in the world, just above that layer and only where they overlap, so a visible player
-- in front of a wall is never painted over by someone behind it.
for _,y in pairs(records) do
local box,want=y.screenBox,nil
if box and y.model then
local padX,padY=box[3]*.6,box[4]*.08
local bx0,by0,bx1,by1=box[1]-padX,box[2]-padY,box[1]+box[3]+padX,box[2]+box[4]+padY
for _,x in pairs(records) do
local h=x.hiddenRect
if x~=y and h and x.dist>y.dist+.5 then
local ix0,iy0,ix1,iy1=math.max(bx0,h[1]),math.max(by0,h[2]),math.min(bx1,h[3]),math.min(by1,h[4])
if ix1>ix0 and iy1>iy0 then
want=want and {math.min(want[1],ix0),math.min(want[2],iy0),math.max(want[3],ix1),math.max(want[4],iy1)} or {ix0,iy0,ix1,iy1}
end
end
end
end
if want then
-- the copy is taken from the rig as it looks right now, chams and all, and retaken on change
local sig=(y.litSig or 'plain')..'|'..tostring(y.model)
if y.frontClone and (y.frontSig~=sig or y.cloneDirty) then y.frontClone.model:Destroy(); y.frontClone=nil end
if not y.frontClone then
y.front=y.front or newLayer()
y.frontClone=cloneRig(y,y.front,false)
y.frontSig=sig
end
if y.frontClone then
showLayer(y.front,cam,math.floor(want[1]),math.floor(want[2]),math.ceil(want[3]),math.ceil(want[4]),8000-2*math.min(math.floor(y.dist),4000))
poseClone(y.frontClone)
end
y.frontUsed=now
elseif y.front then
y.front.clip.Visible=false
if y.frontClone and now-(y.frontUsed or 0)>2 then y.frontClone.model:Destroy(); y.frontClone=nil end
end
end
-- smoothed cost of one ESP frame, for status()
stats.frameMs=(stats.frameMs or 0)*.9+(os.clock()-started)*100
end
-- Sample after all ordinary RenderStepped callbacks, including the presenter.
-- A single pending update avoids accumulating work if a frame is delayed.
local pending=false
local renderConnection=connect(RunService.RenderStepped,function(dt)
if pending or stopped then return end
pending=true
task.defer(function()
pending=false
if not stopped then renderFrame(dt) end
end)
end)
local function cleanup()
stopped=true; renderConnection:Disconnect()
for _,r in pairs(records) do destroy(r) end
table.clear(records); overlay:Destroy()
end
table.insert(cleanups,cleanup)
return {status=function() return table.clone(stats) end}
end
end)()
local installWorldVisuals = (function()
-- World page visuals for the game's own client controllers.
-- Embedded in neverlose_ui.lua next to the live ESP; getValue reads "World/..." settings.
return function(getValue, connect, cleanups, adapter)
local RS=game:GetService('ReplicatedStorage')
local Players=game:GetService('Players')
local RunService=game:GetService('RunService')
local Lighting=game:GetService('Lighting')
local SoundService=game:GetService('SoundService')
local localPlayer=Players.LocalPlayer
local modules=RS:FindFirstChild('Modules')
local function module(path)
if adapter then return adapter.resolve(path) end
local node=modules
for name in path:gmatch('[^/]+') do node=node and node:FindFirstChild(name) end
if not node then return nil end
local ok,result=pcall(require,node)
return ok and result or nil
end
local bullets=module('Client/Controllers/BulletController')
local combat=module('Client/CombatSignals')
local fps=module('Client/Controllers/FPSController')
local gun=module('Client/Controllers/GunController')
local throwable=module('Client/Controllers/ThrowableController')
local exposure=module('Client/Controllers/ExposureController')
local pov=module('Client/CameraPOV')
local presenter=module('Client/Character/OperatorPresenter')
local merc=module('Client/Controllers/MercPlayerController')
local povBody=module('Client/Controllers/MercPOVController')
local WHITE,BLACK=Color3.new(1,1,1),Color3.new(0,0,0)
local function setting(path) return getValue('World/'..path) end
local function on(path) return setting(path)==true end
local function color(path)
local s=tostring(setting(path..'/Color') or 'FFFFFF'):gsub('#','')
return Color3.fromRGB(tonumber(s:sub(1,2),16) or 255,tonumber(s:sub(3,4),16) or 255,tonumber(s:sub(5,6),16) or 255)
end
local function removed(name) return table.find(setting('Removals/Removals') or {},name)~=nil end
local function make(class,props,parent)
local o=Instance.new(class)
for k,v in pairs(props) do o[k]=v end
o.Parent=parent
return o
end
-- Replace a function on one of the game's controller tables; put the original back on unload.
local function hook(target,name,wrap)
if type(target)~='table' or type(target[name])~='function' then return false end
local had,original=rawget(target,name),target[name]
local replacement=wrap(original);target[name]=replacement
table.insert(cleanups,function() if target[name]==replacement then target[name]=had end end)
return true
end
local thirdPerson=false
local overlay=make('ScreenGui',{Name='NeverloseWorld',IgnoreGuiInset=true,ResetOnSpawn=false,DisplayOrder=998,ZIndexBehavior=Enum.ZIndexBehavior.Sibling},localPlayer:WaitForChild('PlayerGui'))
local world=make('Folder',{Name='NeverloseWorldFX'},workspace)
table.insert(cleanups,function() overlay:Destroy(); world:Destroy() end)
---------------------------------------------------------------------------------------
-- Removals (Post Processing and shadows are handled by the menu itself)
---------------------------------------------------------------------------------------
-- Effects the game re-enables every frame are held off the moment it does.
local held={}
local function holdOff(inst,prop,want,active)
if held[inst] then return end
held[inst]=true
local function enforce() if active() and inst[prop]~=want then inst[prop]=want end end
local c=inst:GetPropertyChangedSignal(prop):Connect(enforce)
table.insert(cleanups,function() c:Disconnect() end)
enforce()
end
local function flashOff() return removed('Flash') end
local function smokeOff() return removed('Smoke') end
-- Flash: the game brightens exposure and blurs; drop its exposure share and the blur.
hook(exposure,'SetContribution',function(original)
return function(self,key,value,...)
if key=='Flashbang' and flashOff() then value=nil end
return original(self,key,value,...)
end
end)
local function watchLighting(child)
if child.Name=='FlashbangBlur' then holdOff(child,'Enabled',false,flashOff)
elseif child.Name=='TeargasBlur' or child.Name=='TeargasColorCorrection' then holdOff(child,'Enabled',false,smokeOff) end
end
for _,child in ipairs(Lighting:GetChildren()) do watchLighting(child) end
connect(Lighting.ChildAdded,watchLighting)
-- Smoke: the tear gas cloud and the drifting smoke emitters around it.
local smokeHidden={}
local function isSmoke(inst)
if not inst:IsA('ParticleEmitter') then return false end
local name=inst.Name:lower()
if name:find('smoke') or name:find('gas') or name:find('cloud') then return true end
local model=inst:FindFirstAncestorWhichIsA('Model')
return model~=nil and (model.Name:find('Teargas')~=nil or model.Name:find('Smoke')~=nil)
end
local function hideSmoke(inst)
if smokeHidden[inst]~=nil or not isSmoke(inst) then return end
smokeHidden[inst]=inst.Enabled
inst.Enabled=false
inst:Clear()
end
local smokeActive=false
connect(workspace.DescendantAdded,function(inst)
if smokeActive and inst:IsA('ParticleEmitter') then task.defer(hideSmoke,inst) end
end)
local function setSmoke(active)
if active==smokeActive then return end
smokeActive=active
if active then
for _,inst in ipairs(workspace:GetDescendants()) do if inst:IsA('ParticleEmitter') then hideSmoke(inst) end end
else
for inst,enabled in pairs(smokeHidden) do if inst.Parent then inst.Enabled=enabled end end
table.clear(smokeHidden)
end
end
table.insert(cleanups,function() setSmoke(false) end)
-- Scope overlay: the black surround, cover, lens relief and blackout; the reticle stays.
local SCOPE_PARTS={EdgeLeft=true,EdgeRight=true,EdgeTop=true,EdgeBottom=true,Cover=true,Relief=true,Blackout=true}
local scopeHidden={}
local function stepScope(active)
if active then
local gui=adapter and adapter.scope() or localPlayer.PlayerGui:FindFirstChild('ScopeOverlay')
if gui then
for _,d in ipairs(gui:GetDescendants()) do
if (SCOPE_PARTS[d.Name] or adapter and (d.Name=='Circle' or d.Name=='Blur')) and d:IsA('GuiObject') then
if scopeHidden[d]==nil then scopeHidden[d]=d.Visible end
if d.Visible then d.Visible=false end
end
end
end
elseif next(scopeHidden) then
for d,visible in pairs(scopeHidden) do if d.Parent then d.Visible=visible end end
table.clear(scopeHidden)
end
end
table.insert(cleanups,function() stepScope(false) end)
-- Visual recoil: the camera's shake spring stops taking impulses and the FOV kick is held at
-- rest, just before the camera renders. The aim recoil spring is left alone.
local quiet={}
local function stepRecoil(active)
local cam=fps and fps.camera
local shake=type(cam)=='table' and rawget(cam,'_recoilShakeSpring')
if active and type(shake)=='table' then
if quiet[shake]==nil then quiet[shake]=rawget(shake,'accelerate') or false; rawset(shake,'accelerate',function() end) end
shake.p=Vector3.zero; shake.v=Vector3.zero
local kick=rawget(cam,'_fovRecoilSpring')
if kick then pcall(function() kick:setPos(0); kick:setVel(0) end) end
elseif not active and next(quiet) then
for spring,original in pairs(quiet) do rawset(spring,'accelerate',original or nil) end
table.clear(quiet)
end
end
RunService:BindToRenderStep('NeverloseRecoil',Enum.RenderPriority.Camera.Value-1,function()
stepRecoil(removed('Visual Recoil'))
end)
table.insert(cleanups,function() RunService:UnbindFromRenderStep('NeverloseRecoil'); stepRecoil(false) end)
---------------------------------------------------------------------------------------
-- Effects
---------------------------------------------------------------------------------------
local fading={}
local function fadeOut(duration,update,finish)
table.insert(fading,{start=os.clock(),duration=duration,update=update,finish=finish})
end
connect(RunService.Heartbeat,function()
local now=os.clock()
for i=#fading,1,-1 do
local f=fading[i]
local k=(now-f.start)/f.duration
if k>=1 then table.remove(fading,i); f.finish()
else f.update(k) end
end
end)
table.insert(cleanups,function() for _,f in ipairs(fading) do pcall(f.finish) end; table.clear(fading) end)
local function excludeParams(extra)
local params=RaycastParams.new()
params.FilterType=Enum.RaycastFilterType.Exclude
local list={world,workspace.CurrentCamera}
if localPlayer.Character then table.insert(list,localPlayer.Character) end
for _,e in ipairs(extra or {}) do table.insert(list,e) end
params.FilterDescendantsInstances=list
params.IgnoreWater=true
return params
end
-- Bullet tracers: a glowing beam from the muzzle to where the shot landed.
local tracers=0
local function tracer(from,to,c)
if tracers>=48 then return end
tracers+=1
local a0=make('Attachment',{WorldPosition=from},workspace.Terrain)
local a1=make('Attachment',{WorldPosition=to},workspace.Terrain)
local beam=make('Beam',{Attachment0=a0,Attachment1=a1,Color=ColorSequence.new(c),Width0=.07,Width1=.07,FaceCamera=true,LightEmission=1,LightInfluence=0,Segments=1,
Transparency=NumberSequence.new(0)},a0)
local glow=make('Beam',{Attachment0=a0,Attachment1=a1,Color=ColorSequence.new(c),Width0=.18,Width1=.18,FaceCamera=true,LightEmission=.6,LightInfluence=0,Segments=1,
Transparency=NumberSequence.new(.88)},a0)
fadeOut(1.6,function(k)
local t=k*k
beam.Transparency=NumberSequence.new(t)
glow.Transparency=NumberSequence.new(.88+.12*t)
end,function() a0:Destroy(); a1:Destroy(); tracers-=1 end)
end
local function muzzle(fallback)
if gun and type(gun.GetMuzzleWorldPosition)=='function' then
local ok,p=pcall(gun.GetMuzzleWorldPosition,gun)
if ok and typeof(p)=='Vector3' then return p end
end
return fallback
end
if bullets and bullets.ShotEmitted then
connect(bullets.ShotEmitted,function(_,origin,direction)
if not on('Effects/Bullet Tracers') or typeof(origin)~='Vector3' or typeof(direction)~='Vector3' then return end
local dir=direction.Magnitude>0 and direction.Unit or Vector3.new(0,0,-1)
local hit=workspace:Raycast(origin,dir*2000,excludeParams())
local to=hit and hit.Position or origin+dir*2000
-- shots leave from the eye; in first person the line starts at the gun so it can be seen
tracer(thirdPerson and origin or muzzle(origin),to,color('Effects/Bullet Tracers'))
end)
end
-- Bullet impacts: a small box where each round hit a surface.
local impacts=0
local function impact(position,c)
if impacts>=96 then return end
impacts+=1
local anchor=make('Part',{Anchored=true,CanCollide=false,CanQuery=false,CanTouch=false,Transparency=1,Size=Vector3.new(.05,.05,.05),CFrame=CFrame.new(position)},world)
local box=make('BoxHandleAdornment',{Adornee=anchor,Size=Vector3.new(.22,.22,.22),Color3=c,Transparency=.25,AlwaysOnTop=false,ZIndex=1},anchor)
local edge=make('SelectionBox',{Adornee=anchor,Color3=c,LineThickness=.012,SurfaceTransparency=1,Transparency=0},anchor)
anchor.Size=Vector3.new(.22,.22,.22)
fadeOut(4,function(k)
local t=math.max(0,(k-.6)/.4)
box.Transparency=.25+.75*t; edge.Transparency=t
end,function() anchor:Destroy(); impacts-=1 end)
end
if combat and combat.LocalHit then
connect(combat.LocalHit,function(_,position)
if on('Effects/Bullet Impacts') and typeof(position)=='Vector3' then impact(position,color('Effects/Bullet Impacts')) end
end)
end
-- Hit marker: four short white strokes around the crosshair, red on a headshot.
local marker=make('Frame',{Name='HitMarker',AnchorPoint=Vector2.new(.5,.5),Position=UDim2.fromScale(.5,.5),Size=UDim2.fromOffset(40,40),BackgroundTransparency=1,Visible=false},overlay)
local strokes={}
for i=0,3 do
local angle=math.rad(45+i*90)
local dir=Vector2.new(math.cos(angle),math.sin(angle))
local s=make('Frame',{AnchorPoint=Vector2.new(.5,.5),Position=UDim2.fromOffset(20+dir.X*10,20+dir.Y*10),Size=UDim2.fromOffset(9,2),Rotation=math.deg(angle),BackgroundColor3=WHITE,BorderSizePixel=0},marker)
make('UIStroke',{Color=BLACK,Thickness=1,Transparency=.3},s)
strokes[i+1]=s
end
local markerToken=0
-- Hit sound: tiny generated tones (8-bit PCM WAV) loaded as custom assets.
local function wav(seconds,sample)
local rate=22050
local n=math.floor(seconds*rate)
local bytes=table.create(n)
for i=1,n do
local v=sample((i-1)/rate)
bytes[i]=string.char(math.clamp(math.floor(v*110+128),0,255))
end
local pcm=table.concat(bytes)
return 'RIFF'..string.pack('<I4',36+n)..'WAVEfmt '..string.pack('<I4I2I2I4I4I2I2',16,1,1,rate,rate,1,8)..'data'..string.pack('<I4',n)..pcm
end
local TONES={
Click=function(t) return (math.random()*2-1)*math.exp(-t*900)*.6+math.sin(t*2*math.pi*2600)*math.exp(-t*160)*.5 end,
Bell=function(t) local e=math.exp(-t*7) return (math.sin(t*2*math.pi*1568)+.45*math.sin(t*2*math.pi*2352)+.25*math.sin(t*2*math.pi*3136))*e*.55 end,
Bubble=function(t) return math.sin(2*math.pi*(380*t+2600*t*t))*math.exp(-t*22)*(t<.004 and t/.004 or 1)*.9 end,
}
local LENGTH={Click=.06,Bell=.55,Bubble=.18}
local soundIds={}
local function soundId(name)
if soundIds[name]~=nil then return soundIds[name] or nil end
soundIds[name]=false
local ok,id=pcall(function()
if not isfolder('neverlose_ui/sounds') then makefolder('neverlose_ui/sounds') end
local path='neverlose_ui/sounds/'..name:lower()..'.wav'
if not isfile(path) then writefile(path,wav(LENGTH[name],TONES[name])) end
return getcustomasset(path)
end)
if ok and id then soundIds[name]=id end
return soundIds[name] or nil
end
local function hitSound()
local choice=setting('Effects/Hit Sound')
if not TONES[choice] then return end
local id=soundId(choice)
if not id then
-- no custom assets: fall back to the game's own hitmarker sound
local sounds=RS:FindFirstChild('Assets') and RS.Assets:FindFirstChild('Sounds')
local own=sounds and sounds:FindFirstChild('Hitmarker')
id=own and own.SoundId
end
if not id then return end
local s=make('Sound',{SoundId=id,Volume=1.6},SoundService)
s:Play()
s.Ended:Once(function() s:Destroy() end)
task.delay(3,function() if s.Parent then s:Destroy() end end)
end
if bullets and bullets.HitConfirmed then
connect(bullets.HitConfirmed,function(_,_,headshot)
if on('Effects/Hit Marker') then
markerToken+=1
local token=markerToken
local c=headshot and Color3.fromRGB(255,70,70) or WHITE
for _,s in ipairs(strokes) do s.BackgroundColor3=c; s.BackgroundTransparency=0 end
marker.Visible=true
fadeOut(.45,function(k)
if token~=markerToken then return end
for _,s in ipairs(strokes) do s.BackgroundTransparency=math.max(0,(k-.35)/.65) end
end,function() if token==markerToken then marker.Visible=false end end)
end
hitSound()
end)
end
-- Grenade prediction: the throw the game would make right now, simulated with the same launch
-- numbers (camera spawn point, ThrowSpeed, UpSpeed, the player's run speed, the 240 cap) and
-- workspace gravity, bouncing off surfaces until the fuse runs out.
local arc={}
for i=1,90 do arc[i]=make('Frame',{AnchorPoint=Vector2.new(.5,.5),BorderSizePixel=0,BackgroundColor3=WHITE,Visible=false},overlay) end
local landing=make('Frame',{AnchorPoint=Vector2.new(.5,.5),BackgroundTransparency=1,Visible=false},overlay)
make('UICorner',{CornerRadius=UDim.new(1,0)},landing)
local landingStroke=make('UIStroke',{Color=WHITE,Thickness=2},landing)
local function hideArc() for _,l in ipairs(arc) do l.Visible=false end; landing.Visible=false end
local function predict()
local projectile=throwable and throwable.Active and not throwable._throwing and type(throwable._entry)=='table' and throwable._entry.Projectile
local cam=workspace.CurrentCamera
if type(projectile)~='table' or not cam then return nil end
local cf=cam.CFrame
local pos=(cf*CFrame.new(0,-.6,-(projectile.SpawnDistance or 2))).Position
local vel=cf.LookVector*(projectile.ThrowSpeed or 55)+Vector3.yAxis*(projectile.UpSpeed or 18)
local root=localPlayer.Character and localPlayer.Character:FindFirstChild('HumanoidRootPart')
if root then local v=root.AssemblyLinearVelocity; vel+=Vector3.new(v.X,0,v.Z) end
if vel.Magnitude>240 then vel=vel.Unit*240 end
local g=workspace.Gravity
local params=excludeParams()
local points={pos}
local t,step,fuse=0,1/60,math.min(projectile.FuseTime or 2.5,4)
local bounces=0
while t<fuse and #points<400 do
local nextVel=vel-Vector3.new(0,g*step,0)
local delta=(vel+nextVel)/2*step
local hit=workspace:Raycast(pos,delta,params)
if hit then
pos=hit.Position+hit.Normal*.15
vel=(nextVel-2*nextVel:Dot(hit.Normal)*hit.Normal)*.4
bounces+=1
table.insert(points,pos)
if vel.Magnitude<4 or bounces>5 then break end
else
pos+=delta
vel=nextVel
table.insert(points,pos)
end
t+=step
end
return points
end
local function drawArc(points,cam)
local c=color('Effects/Grenade Prediction')
-- keep about 90 segments however long the throw is
local stride=math.max(1,math.ceil((#points-1)/#arc))
local n=0
for i=1,#points-1,stride do
local a,b=points[i],points[math.min(i+stride,#points)]
local pa,va=cam:WorldToViewportPoint(a)
local pb,vb=cam:WorldToViewportPoint(b)
n+=1
local l=arc[n]
if l and pa.Z>.1 and pb.Z>.1 then
local d=Vector2.new(pb.X-pa.X,pb.Y-pa.Y)
l.Position=UDim2.fromOffset((pa.X+pb.X)/2,(pa.Y+pb.Y)/2)
l.Size=UDim2.fromOffset(d.Magnitude,2)
l.Rotation=math.deg(math.atan2(d.Y,d.X))
l.BackgroundColor3=c
l.BackgroundTransparency=(n%2==0) and .35 or 0
l.Visible=true
elseif l then l.Visible=false end
end
for i=n+1,#arc do arc[i].Visible=false end
local last=cam:WorldToViewportPoint(points[#points])
landing.Visible=last.Z>.1
if landing.Visible then
local r=math.clamp(260/last.Z,6,40)
landing.Position=UDim2.fromOffset(last.X,last.Y); landing.Size=UDim2.fromOffset(r*2,r)
landingStroke.Color=c
end
end
---------------------------------------------------------------------------------------
-- View
---------------------------------------------------------------------------------------
local state=adapter and adapter.worldStatus or {requested=false,active=false,phase='first person',distance=0,errors=0}
local visibility=function()end
if not (adapter and adapter.native) then
-- Viewmodel FOV: move the weapon along the view axis (further for a wider FOV); faded out
-- while aiming so the sights stay where the game puts them. In third person it is put out of
-- sight below the camera.
hook(gun,'GetViewmodelOffset',function(original)
return function(self,...)
local offset,b,c=original(self,...)
if typeof(offset)~='CFrame' then return offset,b,c end
local fov=tonumber(setting('View/Viewmodel FOV')) or 68
local push=(fov-68)*-.012*(1-math.clamp(self.AimAmount or 0,0,1))
if push~=0 then offset=offset+Vector3.new(0,0,push) end
return offset,b,c
end
end)
-- Keep the native eye and muzzle transforms intact. Only the displayed camera moves.
local presenting=false
local hidden={};local shown={};local resolved=nil;local boom=0;local lastResolve=os.clock()
local function restore(values)
for part,value in pairs(values) do if part.Parent then part.LocalTransparencyModifier=value end;values[part]=nil end
end
local function present(want)
if presenting==want or not presenter then return end
presenting=want;presenter.SetViewPresentSelf(want)
end
visibility=function(active)
local sources={}
if active then
local visual=povBody and povBody._state and povBody._state.visual
if visual then sources[visual]=true end
if gun and gun.Weapon and gun.Weapon.Model then sources[gun.Weapon.Model]=true end
end
for part,value in pairs(hidden) do
local keep=false
for model in pairs(sources) do if part:IsDescendantOf(model) then keep=true;break end end
if not keep then if part.Parent then part.LocalTransparencyModifier=value end;hidden[part]=nil end
end
for model in pairs(sources) do for _,part in ipairs(model:GetDescendants()) do
if part:IsA('BasePart') or part:IsA('Decal') then
if hidden[part]==nil then hidden[part]=part.LocalTransparencyModifier end
part.LocalTransparencyModifier=1
end
end end
local rig=active and merc and merc.GetVisual(localPlayer)
for part,value in pairs(shown) do
if not rig or not part:IsDescendantOf(rig) then if part.Parent then part.LocalTransparencyModifier=value end;shown[part]=nil end
end
if rig then for _,part in ipairs(rig:GetDescendants()) do if part:IsA('BasePart') or part:IsA('Decal') then
if shown[part]==nil then shown[part]=part.LocalTransparencyModifier end
part.LocalTransparencyModifier=0
end end end
end
local function wanted()
local char=localPlayer.Character;local hum=char and char:FindFirstChildOfClass('Humanoid')
local vehicle=localPlayer:GetAttribute('VehicleId')
return on('View/Thirdperson') and hum and hum.Health>0 and localPlayer:GetAttribute('Deployed')~=false
and not localPlayer:GetAttribute('Spectating') and not (type(vehicle)=='string' and vehicle~='')
end
local function cameraParams()
local extra={}
local rig=merc and merc.GetVisual(localPlayer)
if rig then table.insert(extra,rig) end
if gun and gun.Weapon and gun.Weapon.Model then table.insert(extra,gun.Weapon.Model) end
local visual=povBody and povBody._state and povBody._state.visual
if visual then table.insert(extra,visual) end
local params=excludeParams(extra);params.RespectCanCollide=true
return params
end
hook(pov,'Resolve',function(original)
return function(eye,...)
local cf=original(eye,...)
local want=wanted()==true;state.requested=want;present(want)
local rig=want and merc and merc.GetVisual(localPlayer)
local scope=gun and gun._ScopeAmount and gun:_ScopeAmount() or 0
thirdPerson=want and rig~=nil and scope<.15 and typeof(eye)=='CFrame'
state.phase=not want and 'first person' or not rig and 'waiting for body' or scope>=.15 and 'scoped' or 'third person'
local now=os.clock();local dt=math.clamp(now-lastResolve,0,.1);lastResolve=now
if not thirdPerson then boom=0;resolved=nil;state.active=false;visibility(false);return cf end
local offset=Vector3.new(1.1,.45,(tonumber(setting('View/Distance')) or 120)/20)
local delta=eye:VectorToWorldSpace(offset)
local params=cameraParams()
local ok,hit=pcall(workspace.Spherecast,workspace,eye.Position,.35,delta,params)
if not ok then hit=workspace:Raycast(eye.Position,delta,params) end
local allowed=hit and math.max(0,hit.Distance-.12) or delta.Magnitude
if allowed<boom then boom=allowed else boom=boom+(allowed-boom)*(1-math.exp(-16*dt)) end
state.distance=boom;state.collision=hit~=nil
if boom<1 then thirdPerson=false;resolved=nil;state.active=false;visibility(false);return cf end
resolved=eye.Rotation+(eye.Position+delta.Unit*boom)
state.active=true;visibility(true)
return resolved
end
end)
-- Aim at the shoulder camera's crosshair, but launch from the original eye.
-- Ragebot wraps this later and supplies its target direction when tracking.
hook(gun,'GetFireDirectionUnspread',function(original)
return function(self,...)
if thirdPerson and resolved and pov then
local eye=pov.GetEyePosition()
local hit=workspace:Raycast(resolved.Position,resolved.LookVector*2000,cameraParams())
local point=hit and hit.Position or resolved.Position+resolved.LookVector*2000
local delta=point-eye
if delta.Magnitude>.001 then return delta.Unit end
end
return original(self,...)
end
end)
table.insert(cleanups,function()thirdPerson=false;present(false);restore(hidden);restore(shown)end)
end
RunService:BindToRenderStep('NeverloseWorldVisuals',Enum.RenderPriority.Last.Value,function()
setSmoke(removed('Smoke'))
stepScope(removed('Scope Overlay'))
if adapter then thirdPerson=adapter.thirdPerson end
local ok,err=pcall(visibility,thirdPerson)
if not ok then state.errors=state.errors+1;state.lastError=tostring(err) end
local cam=workspace.CurrentCamera
local points=on('Effects/Grenade Prediction') and cam and predict()
if points and #points>1 then drawArc(points,cam) else hideArc() end
end)
table.insert(cleanups,function() RunService:UnbindFromRenderStep('NeverloseWorldVisuals') end)
return {
status=function()return table.clone(state)end,
testHit=function(headshot) if bullets and bullets.HitConfirmed then bullets.HitConfirmed:Fire(nil,25,headshot==true,Vector3.zero) end end,
testTracer=function(from,to) tracer(from,to,color('Effects/Bullet Tracers')) end,
testImpact=function(position) impact(position,color('Effects/Bullet Impacts')) end,
}
end
end)()
local installRagebot = (function()
-- Ragebot for the custom Participant / OperatorPresenter weapon pipeline.
local RageMath=(function()
local M={}
function M.profile(name,cfg)
local n=tostring(name):lower(); local kind=tostring(cfg.Category or cfg.WeaponType or ''):lower()
if n=='sniper' or n:find('awp') or n:find('awm') then return 'AWP' end
if n:find('scout') or n:find('ssg') then return 'Scout' end
if kind:find('sniper') or n:find('scar20') or n:find('g3sg') then return 'Auto Snipers' end
if n:find('deagle') or n:find('eagle') or n:find('revolver') or tostring(cfg.AmmoType):find('50') then return 'Heavy Pistols' end
if kind:find('pistol') or n=='m18' or n:find('glock') or n:find('m1911') or n:find('p226') then return 'Pistols' end
if kind:find('smg') or n:find('ump') or n:find('mp5') or n:find('mp7') or n:find('mp9') or n:find('p90') or n:find('vector') or n:find('uzi') then return 'SMG' end
return 'Rifles'
end
function M.setting(store,path,profile)
local value=store.values[path..'@'..profile]
if value==nil then value=store.values[path..'@Global'] end
if value==nil then value=store.defaults[path] end
return value
end
function M.chance(radius,distance,spreadDegrees)
if distance<=.001 or spreadDegrees<=.00001 then return 100 end
local spread=math.tan(math.rad(math.min(spreadDegrees,89)))*distance
return math.clamp((radius/math.max(spread,.00001))^2*100,0,100)
end
-- Ray/OBB test in the hitbox's local coordinates.
function M.rayBox(origin,direction,half,maxDistance)
local enter,leave=0,maxDistance or math.huge
for _,axis in ipairs({'X','Y','Z'}) do
local o,d,h=origin[axis],direction[axis],half[axis]
if math.abs(d)<1e-8 then if o < -h or o > h then return false end
else
local a,b=(-h-o)/d,(h-o)/d
if a>b then a,b=b,a end
enter=math.max(enter,a);leave=math.min(leave,b)
if enter>leave then return false end
end
end
return leave>=0 and enter<=leave
end
function M.cone(base,degrees,u,v)
local z=math.cos(math.rad(degrees));z=z+(1-z)*u
local r=math.sqrt(math.max(0,1-z*z));local phi=v*2*math.pi
local forward=base.Unit
local right=forward:Cross(math.abs(forward.Y)>.99 and Vector3.xAxis or Vector3.yAxis).Unit
local up=right:Cross(forward).Unit
return (right*(r*math.cos(phi))+up*(r*math.sin(phi))+forward*z).Unit
end
function M.compensate(desired,degrees,u,v)
local base=desired.Unit
for _=1,24 do
local actual=M.cone(base,degrees,u,v)
if (actual-desired).Magnitude<2e-6 then return base end
local axis=actual:Cross(desired)
if axis.Magnitude<1e-10 then break end
base=CFrame.fromAxisAngle(axis.Unit,math.atan2(axis.Magnitude,actual:Dot(desired))):VectorToWorldSpace(base).Unit
end
return nil
end
function M.better(a,b,priority,bodyAim)
if not b then return true end
if bodyAim=='Prefer' and a.body~=b.body then return a.body end
if priority=='Lowest Health' and a.health~=b.health then return a.health<b.health end
if priority=='Lowest Distance' and a.distance~=b.distance then return a.distance<b.distance end
if priority=='Hit Chance' and a.chance~=b.chance then return a.chance>b.chance end
if a.damage~=b.damage then return a.damage>b.damage end
if a.chance~=b.chance then return a.chance>b.chance end
if a.angle~=b.angle then return a.angle<b.angle end
return a.distance<b.distance
end
return M
end)()
return function(Store,connect,cleanups,isMenuOpen,notify,adapter)
local RS=game:GetService('ReplicatedStorage')
local Players=game:GetService('Players')
local RunService=game:GetService('RunService')
local UIS=game:GetService('UserInputService')
local localPlayer=Players.LocalPlayer
local function module(path)
if adapter then return adapter.resolve(path) end
local node=RS
for name in path:gmatch('[^/]+') do node=node and node:FindFirstChild(name) end
if not node then return nil end
local ok,value=pcall(require,node)
return ok and value or nil
end
local gun=module('Modules/Client/Controllers/GunController')
local bullets=module('Modules/Client/Controllers/BulletController')
local pov=module('Modules/Client/CameraPOV')
local cameraController=module('Modules/Client/Controllers/CameraController')
local spreadUtil=module('Modules/Shared/SpreadUtil')
local movement=module('Modules/Client/QuakeMove')
local participants=module('Modules/Shared/Participant')
local merc=module('Modules/Client/Controllers/MercPlayerController')
local hostility=module('Modules/Shared/Combat/Hostility')
local damageModel=module('Modules/Shared/BodyDamage')
local penetration=module('Modules/Shared/Penetration')
local cartridge=module('Modules/Shared/Weapons/WeaponCartridge')
local weapons=module('Registries/Weapons') or {}
local bulletDefs=module('Registries/BulletDefs') or {}
local state={phase='idle',profile='Global',scans=0,shots=0,errors=0,unsupported={}}
local target,stopped,scanning=nil,false,false
local records={}; local lastDiscovery=0; local lastScan=-math.huge
local ownScope=false; local stopMovement=false
local function get(path,profile)
return RageMath.setting(Store,'Ragebot/'..path,profile or state.profile)
end
local function hook(object,name,wrap)
if type(object)~='table' or type(object[name])~='function' then return false end
local original=object[name]
local replacement=wrap(original)
object[name]=replacement
table.insert(cleanups,function() if object[name]==replacement then object[name]=original end end)
return true
end
local function body(owner)
return participants and participants.BodyOf(owner) or (owner:IsA('Player') and owner.Character or nil)
end
local function health(owner,model)
if adapter then return adapter.health(owner) end
if owner:GetAttribute('Dead')==true or model:GetAttribute('Dead')==true or model:GetAttribute('Ragdolled')==true then return 0 end
local value=tonumber(owner:GetAttribute('BotHealth'))
local b=body(owner)
local humanoid=b and b:FindFirstChildOfClass('Humanoid') or model:FindFirstChildOfClass('Humanoid')
return value or (humanoid and humanoid.Health) or 0
end
local function hostile(owner)
return owner~=localPlayer and hostility and hostility.IsHostile(localPlayer,owner)
end
local function deflecting(owner)
return get('Accuracy/Anti-Katana')==true and adapter and adapter.isDeflecting and adapter.isDeflecting(owner)==true
end
local function protectionReason(owner)
if deflecting(owner)then return 'katana deflecting'end
if get('Accuracy/Anti-Shield')==true and adapter and adapter.isShielding and adapter.isShielding(owner)==true then return 'shield protected'end
end
local function enabled(profile)
return get('Main/Enabled','Global')==true and get('Main/Enabled',profile)==true
end
local function blocked()
if stopped or not enabled() then return 'disabled' end
if isMenuOpen() or UIS:GetFocusedTextBox() then return 'menu open' end
if not gun or not bullets or not pov or not participants or not merc or not hostility or not damageModel then return 'missing game adapter' end
if adapter then local why=adapter.blocked();if why then return why end end
if not gun.Weapon or not gun.Enabled then return 'no active weapon' end
local character=(adapter and adapter.character() or localPlayer.Character)
local hum=character and character:FindFirstChildOfClass('Humanoid')
if not hum or hum.Health<=0 or localPlayer:GetAttribute('Deployed')==false then return 'not deployed' end
if gun:ShouldBlockWeaponInput() then return 'game input blocked' end
if gun._launcher or gun._isGenericItem or gun.ItemDisabled then return 'unsupported weapon' end
if gun.Weapon.IsReloading or gun.SwapPhase~='idle' then return 'weapon busy' end
return nil
end
-- Peek at a clone only; the original spread function advances the live RNG normally.
local spreadRng=nil
if spreadUtil and debug.getupvalues then
local ok,values=pcall(debug.getupvalues,spreadUtil.RandomConeDirection)
if ok then for _,value in pairs(values) do
if typeof(value)=='Random' and pcall(function()return value:Clone()end) then spreadRng=value;break end
end end
end
state.seedSupported=spreadRng~=nil;state.seedCorrections=0;state.seedFailures=0
local spreadDepth=0
local function seedActive()
return spreadRng~=nil and enabled() and get('Accuracy/Seed Prediction')==true and not blocked()
end
local function seedBase(direction,angle)
local copy=spreadRng:Clone()
return RageMath.compensate(direction,angle,copy:NextNumber(),copy:NextNumber())
end
local function scoped(original,...)
spreadDepth=spreadDepth+1
local result=table.pack(pcall(original,...))
spreadDepth=spreadDepth-1
if not result[1] then error(result[2],0) end
return table.unpack(result,2,result.n)
end
hook(spreadUtil,'RandomConeDirection',function(original)
return function(direction,angle,...)
if spreadDepth>0 and angle>0 and seedActive() then
local base=seedBase(direction.Unit,angle)
if base then
local result=original(base,angle,...)
state.seedCorrections=state.seedCorrections+1
state.seedError=(result-direction.Unit).Magnitude
return result
end
state.seedFailures=state.seedFailures+1
end
return original(direction,angle,...)
end
end)
hook(gun,'GetFireDirection',function(original)
return function(self,...)if self==gun then return scoped(original,self,...) end;return original(self,...)end
end)
hook(bullets,'Discharge',function(original)
return function(self,name,...)
if gun and gun.Weapon and name==gun.Weapon.Name then return scoped(original,self,name,...) end
return original(self,name,...)
end
end)
hook(gun,'ApplyRecoil',function(original)
return function(self,...)if self==gun and seedActive() then return end;return original(self,...)end
end)
for _,name in ipairs({'Recoil','RecoilRock'}) do
hook(cameraController,name,function(original)
return function(self,...)if self==cameraController._active and seedActive() then return end;return original(self,...)end
end)
end
local function release()
target=nil; stopMovement=false; state.target=nil
if ownScope then
if not UIS:IsMouseButtonPressed(Enum.UserInputType.MouseButton2) and gun and gun.AimHeld and not gun._aimLatched then gun:StopAiming() end
ownScope=false
end
end
local groups=adapter and adapter.targetGroups or {Head={'Head'},Chest={'UpperTorso','Torso'},Stomach={'LowerTorso'},Arms={'LeftUpperArm','RightUpperArm','LeftLowerArm','RightLowerArm'},Legs={'LeftUpperLeg','RightUpperLeg','LeftLowerLeg','RightLowerLeg'},Feet={'LeftFoot','RightFoot'}}
local function refreshRecords(now)
if now-lastDiscovery<.3 then return end
lastDiscovery=now
local seen={}
for _,owner in ipairs(participants.All()) do
if hostile(owner) then
seen[owner]=true
local model=merc.GetVisual(owner)
local old=records[owner]
if model and (not old or old.model~=model or now-(old.lastBuild or 0)>1) then
local map={}
for _,part in ipairs(model:GetDescendants()) do
if part:IsA('BasePart') then
local zone=part:GetAttribute('MercBodyPart') or part.Name
if not map[zone] or part.CanQuery then map[zone]=part end
end
end
if adapter then map=adapter.zones(owner) end
records[owner]={owner=owner,model=model,zones=map,lastBuild=now}
elseif not model then records[owner]=nil end
end
end
for owner in pairs(records) do if not seen[owner] then records[owner]=nil end end
end
local function isPartOf(instance,record)
return instance and instance:IsDescendantOf(record.model)
end
local function trace(record,origin,point,spec,params,muzzle)
local delta=point-origin
if delta.Magnitude<.001 then return nil end
local direction=delta.Unit
-- Use the game's own muzzle-clearance and glass-aware predictor first.
local predicted=bullets:PredictHit(gun.Weapon.Name,origin,direction,muzzle,0,function(part) return isPartOf(part,record) end)
if predicted then return predicted,1 end
if not get('Main/Automatic Penetration') or not penetration then return nil end
local pen=penetration.NewState(spec)
if not pen then return nil end
local exclude=table.clone(params.FilterDescendantsInstances)
local rayParams=RaycastParams.new()
rayParams.FilterType=Enum.RaycastFilterType.Exclude
rayParams.IgnoreWater=params.IgnoreWater;rayParams.CollisionGroup=params.CollisionGroup
params=rayParams
local start=origin
for _=1,5 do
params.FilterDescendantsInstances=exclude
local hit=workspace:Raycast(start,point-start,params)
if not hit then break end
if isPartOf(hit.Instance,record) then return hit.Instance,penetration.Carry(pen) end
local ownerId=hit.Instance:GetAttribute('OwnerUserId')
local owner=ownerId and participants.ByIdOf(ownerId)
if not owner or not hostile(owner) then break end
local rig=merc.GetVisual(owner)
local zone=hit.Instance:GetAttribute('MercBodyPart') or hit.Instance.Name
if not rig or not penetration.Pass(pen,zone) then break end
table.insert(exclude,rig)
start=hit.Position+direction*.02
end
return nil
end
local function pointFor(candidate,origin,spec)
local base=candidate.part.CFrame:PointToWorldSpace(candidate.offset)
local def=bulletDefs[spec.Projectile]
if not def or (def.Speed or 0)<=0 then return base end
local b=body(candidate.owner)
local root=b and b:FindFirstChild('HumanoidRootPart')
local velocity=root and root.AssemblyLinearVelocity or candidate.velocity or Vector3.zero
local acceleration=def.Acceleration or Vector3.zero
local point=base
for _=1,5 do
local time=(point-origin).Magnitude/def.Speed
point=base+velocity*time-acceleration*(.5*time*time)
end
return point
end
local function spreadChance(candidate,origin,point,spec,samples)
local angle=math.max(0,gun:_GetEffectiveBloomDeg())+math.deg(spec.SpreadAngle or 0)
if angle<.00001 then return 100 end
if seedActive() and seedBase((point-origin).Unit,gun:_GetEffectiveBloomDeg()) and seedBase((point-origin).Unit,math.deg(spec.SpreadAngle or 0)) then return 100 end
local delta=point-origin
if delta.Magnitude<.001 then return 100 end
local direction=delta.Unit
local right=direction:Cross(Vector3.yAxis)
if right.Magnitude<.001 then right=direction:Cross(Vector3.xAxis) end
right=right.Unit
local up=right:Cross(direction).Unit
local cf=candidate.part.CFrame
local lead=point-cf:PointToWorldSpace(candidate.offset)
local localOrigin=cf:PointToObjectSpace(origin-lead)
local half=candidate.part.Size*.49
local maxDistance=(bulletDefs[spec.Projectile] or {}).MaxDistance or spec.Range or 1000
local cap=math.cos(math.rad(math.min(angle,89)))
local hits=0
for i=0,samples-1 do
local cosine=1-(1-cap)*(i+.5)/samples
local sine=math.sqrt(math.max(0,1-cosine*cosine))
local phi=i*2.399963229728653
local ray=adapter and adapter.sampleSpread(direction,angle,i,samples) or direction*cosine+(right*math.cos(phi)+up*math.sin(phi))*sine
if RageMath.rayBox(localOrigin,cf:VectorToObjectSpace(ray),half,maxDistance) then hits+=1 end
end
return hits/samples*100
end
local function specFor(weapon)
return cartridge and cartridge.SpecFor(localPlayer,weapon.Name) or weapons[weapon.Name]
end
local function discover()
if scanning then return target end
scanning=true
local ok,result=pcall(function()
local weapon=gun and gun.Weapon
if not weapon then state.phase='no active weapon'; return nil end
local spec=specFor(weapon)
if not spec then state.phase='missing weapon specification'; return nil end
state.profile=RageMath.profile(weapon.Name,weapons[weapon.Name] or spec)
state.weapon=weapon.Name
local why=blocked()
if why then state.phase=why; return nil end
if not bullets:AssistSupported(weapon.Name) then state.phase='unsupported projectile'; return nil end
local now=os.clock(); refreshRecords(now)
local eye=pov.GetEyeCFrame(); local origin=eye.Position
local params=bullets.ProjectileParams(localPlayer)
local muzzle=gun:GetActiveProjectileMuzzleWorldCFrame()
local best=nil;local protected=0;local shielded=0;local damageRejected=0;local bestDamage=0
local minDamage=tonumber(get('Accuracy/Minimum Damage')) or 0
local fov=tonumber(get('Main/Field of View')) or 180
local selected=get('Selection/Hitboxes') or {}
local multi=get('Selection/Multipoint') or {}
local bodyAim=get('Selection/Body Aim') or 'Default'
for owner,record in pairs(records) do
local hp=health(owner,record.model)
if adapter then record.zones=adapter.zones(owner)end
local protection=hp>0 and record.model.Parent and hostile(owner)and protectionReason(owner)
if protection=='katana deflecting'then protected+=1
elseif protection=='shield protected'then shielded+=1 end
if hp>0 and record.model.Parent and hostile(owner) and not protection then
for _,group in ipairs(selected) do
if bodyAim~='Force' or group~='Head' then
for _,zone in ipairs(groups[group] or {}) do
local part=record.zones[zone]
if part and part.Parent then
local offsets={Vector3.zero}
if table.find(multi,group) then
local scale=(tonumber(get(group=='Head' and 'Selection/Head Scale' or 'Selection/Body Scale')) or 50)/100*.5
table.insert(offsets,Vector3.new(part.Size.X*scale,0,0));table.insert(offsets,Vector3.new(-part.Size.X*scale,0,0))
table.insert(offsets,Vector3.new(0,part.Size.Y*scale,0));table.insert(offsets,Vector3.new(0,-part.Size.Y*scale,0))
end
for pointIndex,offset in ipairs(offsets) do
local candidate={owner=owner,model=record.model,part=part,offset=offset,health=hp,body=group~='Head',weapon=weapon}
local point=pointFor(candidate,origin,spec)
local delta=point-origin; local distance=delta.Magnitude
if distance>.01 and distance<=((bulletDefs[spec.Projectile] or {}).MaxDistance or spec.Range or 1000) then
local angle=math.deg(math.acos(math.clamp(eye.LookVector:Dot(delta.Unit),-1,1)))
if angle<=fov then
local hit,carry=trace(record,origin,part.CFrame:PointToWorldSpace(offset),spec,params,muzzle)
if hit then
local actualZone=(adapter and adapter.zone(hit)) or hit:GetAttribute('MercBodyPart') or hit.Name
local damage=damageModel.BaseDamageAtDistance(spec,distance)*(actualZone=='Head' and (spec.HeadshotMult or 1) or damageModel.Multiplier(actualZone))*carry
bestDamage=math.max(bestDamage,damage)
if minDamage>0 and damage<minDamage and damage<hp then damageRejected+=1 end
if (bodyAim~='Force' or actualZone~='Head') and (minDamage==0 or damage>=minDamage or damage>=hp) then
candidate.body=actualZone~='Head'
candidate.point=point;candidate.distance=distance;candidate.angle=angle;candidate.damage=damage
candidate.chance=spreadChance(candidate,origin,point,spec,24)
candidate.penetrated=carry<1
if RageMath.better(candidate,best,get('Selection/Target'),bodyAim) then best=candidate end
if pointIndex==1 then break end
end
end
end
end
end
end
end
end
end
end
end
state.scans+=1;state.deflectingTargets=protected;state.shieldedTargets=shielded
state.minimumDamage=minDamage;state.bestAvailableDamage=bestDamage;state.damageRejected=damageRejected
state.phase=best and 'tracking' or damageRejected>0 and 'damage below minimum' or protected>0 and 'katana deflecting' or shielded>0 and 'shield protected' or 'no valid target'
if best then best.expires=now+.15; state.target={name=participants.NameOf(best.owner),zone=best.part.Name,damage=best.damage,chance=best.chance,distance=best.distance,penetrated=best.penetrated} else state.target=nil end
return best
end)
scanning=false
if not ok then
state.errors+=1;state.lastError=tostring(result);state.phase='error'
if state.errors==1 then warn('[Neverlose for RIVALS Ragebot] '..state.lastError) end
return nil
end
return result
end
local function validTarget()
if not target or not gun or target.weapon~=gun.Weapon or os.clock()>target.expires or not target.part.Parent or not target.model.Parent or not hostile(target.owner) or health(target.owner,target.model)<=0 then return nil end
if blocked() then return nil end
local protection=protectionReason(target.owner)
if protection then state.phase=protection;return nil end
return target
end
if adapter then
table.insert(cleanups,adapter.setShotTargetProvider(function(origin)
local candidate=validTarget();if not candidate then return end
local point=pointFor(candidate,origin,specFor(gun.Weapon))
return point,candidate.part,CFrame.new(candidate.part.CFrame:PointToObjectSpace(point))
end))
table.insert(cleanups,adapter.setHideScopeProvider(function()return get('Accuracy/Hide Scope')==true end))
table.insert(cleanups,adapter.setHideShotsProvider(function()
local w=gun and gun.Weapon
if stopped or not w or not bullets:AssistSupported(w.Name)then return false end
-- Resolve the equipped profile immediately, including switches between render steps.
local profile=RageMath.profile(w.Name,weapons[w.Name]or {})
return enabled(profile)and get('Accuracy/Hide Shots',profile)==true
end))
end
local legacyScope,legacyScopeEnabled
local function hideLegacyScope()
if adapter then return end
local gui=localPlayer.PlayerGui:FindFirstChild('ScopeOverlay')
if legacyScope and (gui~=legacyScope or get('Accuracy/Hide Scope')~=true)then
if legacyScope.Parent then legacyScope.Enabled=legacyScopeEnabled end;legacyScope=nil
end
if gui and gui:IsA('ScreenGui')and get('Accuracy/Hide Scope')==true then
if not legacyScope then legacyScope=gui;legacyScopeEnabled=gui.Enabled end
gui.Enabled=false
end
end
table.insert(cleanups,function()if legacyScope and legacyScope.Parent then legacyScope.Enabled=legacyScopeEnabled end end)
hook(gun,'GetFireDirectionUnspread',function(original)
return function(self,...)
local candidate=validTarget()
if candidate then
local origin=pov.GetEyePosition();local point=pointFor(candidate,origin,specFor(self.Weapon))
local delta=point-origin
if delta.Magnitude>.001 then return delta.Unit end
end
return original(self,...)
end
end)
hook(movement,'GetWishDir',function(original)
return function(self,...)
if not stopped and not blocked() then
if stopMovement then
if get('Accuracy/Auto Stop')=='Full' then self.Velocity=Vector3.new(0,self.Velocity.Y,0) end
return Vector3.zero
end
end
return original(self,...)
end
end)
local function step()
if stopped then return end
if gun and gun.Weapon then state.profile=RageMath.profile(gun.Weapon.Name,weapons[gun.Weapon.Name] or {}) end
hideLegacyScope()
local why=blocked()
if why then state.phase=why;release();return end
local now=os.clock()
if now-lastScan>=.05 then target=discover();lastScan=now end
local candidate=validTarget()
if not candidate then release();return end
local threshold=tonumber(get('Accuracy/Hit Chance')) or 0
state.requiredHitChance=threshold
local ready=candidate.chance>=threshold
local scopeReady=true
local stopMode=get('Accuracy/Auto Stop') or 'Disabled'
local wait=gun.Weapon:TimeUntilNextPull()
stopMovement=stopMode=='Early' or stopMode=='Full' or stopMode=='Between Shots' and wait>0
if get('Accuracy/Auto Scope') and (state.profile=='AWP' or state.profile=='Scout' or state.profile=='Auto Snipers') then
if not gun.AimHeld then gun:StartAiming();ownScope=true end
if (gun.AimAmount or 0)<.9 then ready=false;scopeReady=false;state.phase='scoping' end
end
if not get('Main/Silent Aim') and cameraController and cameraController._active then
local eye=pov.GetEyePosition()
local cam=workspace.CurrentCamera
local aimOrigin=cam and (cam.CFrame.Position-eye).Magnitude>.5 and cam.CFrame.Position or eye
local dir=(pointFor(candidate,eye,specFor(gun.Weapon))-aimOrigin).Unit
local camera=cameraController._active
local yaw=math.atan2(-dir.X,-dir.Z);local pitch=math.asin(math.clamp(dir.Y,-1,1))
camera._yawTarget=yaw;camera._yawCurrent=yaw;camera._pitchTarget=pitch;camera._pitchCurrent=pitch
end
-- Re-check the live hitbox, muzzle clearance, damage and current spread immediately
-- before firing. Acquisition can be up to one scan old; the shot must not be.
if get('Main/Automatic Fire') and wait<=0 then
local spec=specFor(gun.Weapon)
local origin=pov.GetEyePosition()
local current=candidate.part.CFrame:PointToWorldSpace(candidate.offset)
local record=records[candidate.owner]
local hit,carry
-- Preserve both returns from the native trace.
if record then hit,carry=trace(record,origin,current,spec,bullets.ProjectileParams(localPlayer),gun:GetActiveProjectileMuzzleWorldCFrame()) end
if not hit then state.phase='shot obstructed';target=nil;return end
local zone=(adapter and adapter.zone(hit)) or hit:GetAttribute('MercBodyPart') or hit.Name
local dealt=damageModel.BaseDamageAtDistance(spec,(current-origin).Magnitude)*(zone=='Head' and (spec.HeadshotMult or 1) or damageModel.Multiplier(zone))*(carry or 1)
local minimum=tonumber(get('Accuracy/Minimum Damage')) or 0
if minimum>0 and dealt<minimum and dealt<health(candidate.owner,candidate.model) then state.phase='damage below minimum';return end
candidate.chance=spreadChance(candidate,origin,pointFor(candidate,origin,spec),spec,64)
ready=scopeReady and candidate.chance>=threshold
if state.target then state.target.chance=candidate.chance;state.target.damage=dealt end
state.accuracySamples=64
end
state.currentHitChance=candidate.chance
if not ready then state.phase=scopeReady and 'waiting for accuracy' or 'scoping';return end
if get('Main/Automatic Fire') and wait<=0 and not gun.Weapon.BurstFiring then
local protection=protectionReason(candidate.owner)
if protection then state.phase=protection;release();return end
gun.Weapon:ReleaseTrigger()
if gun:FireWeapon() then state.shots+=1;state.phase='fired' end
end
end
local pending=false
connect(RunService.RenderStepped,function()
if pending or stopped then return end
pending=true
task.defer(function()
pending=false
if stopped then return end
local ok,err=pcall(step)
if not ok then release();state.errors+=1;state.lastError=tostring(err);state.phase='error';if state.errors==1 then warn('[Neverlose for RIVALS Ragebot] '..state.lastError) end end
end)
end)
table.insert(cleanups,function() stopped=true;release();table.clear(records) end)
return {
status=function() local copy=table.clone(state);copy.unsupported=table.clone(state.unsupported);if state.target then copy.target=table.clone(state.target) end;return copy end,
scan=function() target=discover();return target and {name=participants.NameOf(target.owner),zone=target.part.Name,damage=target.damage,chance=target.chance} or nil end,
}
end
end)()
local installLegitbot = (function()
-- Camera aim assist through the game's native camera controller. Never fires a weapon.
local LegitMath={}
function LegitMath.wrap(angle)return (angle+math.pi)%(2*math.pi)-math.pi end
function LegitMath.alpha(smoothing,dt)return 1-math.exp(-60*math.clamp(dt,0,.1)/math.max(1,smoothing))end
function LegitMath.angle(current,target,smoothing,dt)return current+LegitMath.wrap(target-current)*LegitMath.alpha(smoothing,dt)end
return function(Store,connect,cleanups,isMenuOpen,adapter)
local Players=game:GetService('Players')
local RS=game:GetService('ReplicatedStorage')
local Run=game:GetService('RunService')
local UIS=game:GetService('UserInputService')
local player=Players.LocalPlayer
local function module(path)
if adapter then return adapter.resolve(path)end
local node=RS:FindFirstChild('Modules')
for name in path:gmatch('[^/]+')do node=node and node:FindFirstChild(name)end
if not node then return nil end
local ok,value=pcall(require,node);return ok and value or nil
end
local participants=module('Shared/Participant')
local hostility=module('Shared/Combat/Hostility')
local merc=module('Client/Controllers/MercPlayerController')
local gun=module('Client/Controllers/GunController')
local bullets=module('Client/Controllers/BulletController')
local pov=module('Client/CameraPOV')
local cameraController=module('Client/Controllers/CameraController')
local function get(path)
local key='Legitbot/'..path;local value=Store.values[key]
if value==nil then value=Store.defaults[key]end
return value
end
local function rgba()
local s=tostring(get('Visuals/FOV Circle/Color')or '69A7FF'):gsub('#','')
return Color3.fromRGB(tonumber(s:sub(1,2),16)or 105,tonumber(s:sub(3,4),16)or 167,tonumber(s:sub(5,6),16)or 255)
end
local overlay=Instance.new('ScreenGui');overlay.Name='NeverloseLegit';overlay.IgnoreGuiInset=true;overlay.ResetOnSpawn=false;overlay.DisplayOrder=997;overlay.Parent=player:WaitForChild('PlayerGui')
local circle=Instance.new('Frame');circle.Name='AimFOV';circle.BackgroundTransparency=1;circle.AnchorPoint=Vector2.new(.5,.5);circle.Visible=false;circle.Parent=overlay
local corner=Instance.new('UICorner');corner.CornerRadius=UDim.new(1,0);corner.Parent=circle
local stroke=Instance.new('UIStroke');stroke.Thickness=1;stroke.Transparency=.4;stroke.Parent=circle
local state={phase='disabled',errors=0,aimFrames=0}
local stopped=false;local target;local acquired=0
local function clear(phase)target=nil;state.target=nil;state.phase=phase end
local function held()
if get('Main/Activation')=='Always'then return true end
local key=get('Main/Aim Key')or 'Mouse2'
local buttons={Mouse1=Enum.UserInputType.MouseButton1,Mouse2=Enum.UserInputType.MouseButton2,Mouse3=Enum.UserInputType.MouseButton3}
if buttons[key]then return UIS:IsMouseButtonPressed(buttons[key])end
local ok,code=pcall(function()return Enum.KeyCode[key]end)
return ok and code~=Enum.KeyCode.Unknown and UIS:IsKeyDown(code)
end
local function blocked()
if get('Main/Enabled')~=true then return 'disabled'end
if isMenuOpen() or UIS:GetFocusedTextBox()then return 'menu open'end
local rage=Store.values['Ragebot/Main/Enabled@Global']
if rage==nil then rage=Store.defaults['Ragebot/Main/Enabled']end
if rage==true then return 'Ragebot priority'end
if not (participants and hostility and merc and gun and bullets and pov and cameraController and cameraController._active)then return 'missing game adapter'end
if not gun.Weapon or not gun.Enabled then return 'no active weapon'end
if gun:ShouldBlockWeaponInput()then return 'game input blocked'end
if adapter then local w=adapter.nativeItem();if w and w.Info.Type~='Gun'then return 'not a gun'end end
local character=adapter and adapter.character()or player.Character
local hum=character and character:FindFirstChildOfClass('Humanoid')
if not hum or hum.Health<=0 then return 'not deployeStay safe
Never paste your .ROBLOSECURITY cookie anywhere, and use an alt account with scripts.

Universal