-- WEAPON CONTROLLER SCRIPT (~3200 chars) local wc=Instance.new("LocalScript",game.StarterPlayer.StarterPlayerScripts)wc.Name="WeaponController" wc.Source=[[ local P=game:GetService("Players")local RS=game:GetService("RunService")local UI=game:GetService("UserInputService")local RepS=game:GetService("ReplicatedStorage")local TS=game:GetService("TweenService")local D=game:GetService("Debris") local pl=P.LocalPlayer local cam=workspace.CurrentCamera local ms=pl:GetMouse() local E=RepS:WaitForChild("Events")local HE=E.HitEvent local KE=E.KillEvent local WD=require(RepS:WaitForChild("Shared"):WaitForChild("WeaponData")) local ci=1 ammo={} isR=false isA=false canS=true ro=0 so=0 kills=0 ks=0 lkt=0 holdM=false for i,w in ipairs(WD)do ammo[i]=w.MagSize end local km={}for i,w in ipairs(WD)do km[w.Key]=i end local function sw(idx) if idx<1 or idx>#WD or isR then return end ci=idx local w=WD[ci] isA=false cam.FieldOfView=70 ro=0 so=0 local hd=pl.PlayerGui:FindFirstChild("FPS_HUD") if hd then local at=hd.AmmoFrame.AmmoText local wn=hd.AmmoFrame.WeaponName if at then at.Text=ammo[ci].." / "..w.MagSize end if wn then wn.Text=w.Name end end end UI.InputBegan:Connect(function(i,g)if g then return end if km[i.KeyCode]then sw(km[i.KeyCode])end if i.UserInputType==Enum.UserInputType.MouseButton2 then local w=WD[ci]if w.ScopeZoom then isA=true cam.FieldOfView=70/w.ScopeZoom else isA=true TS:Create(cam,TweenInfo.new(0.15),{FieldOfView=45}):Play()end end if i.KeyCode==Enum.KeyCode.R and not isR then local w=WD[ci]if ammo[ci]1 then d=ro2+Vector3.new((math.random()-0.5)*w.Spread*2,(math.random()-0.5)*w.Spread*2,(math.random()-0.5)*w.Spread*2).Unit end local r=workspace:Raycast(h.Position,d*w.Range,rp) if r then local hp=r.Instance local hs=hp.Name=="Head" local tr=Instance.new("Part",workspace)tr.Size=Vector3.new(0.1,0.1,(r.Position-h.Position).Magnitude)tr.CFrame=CFrame.lookAt(h.Position,r.Position)*CFrame.new(0,0,-tr.Size.Z/2)tr.Anchored=true tr.CanCollide=false tr.BrickColor=BrickColor.new("Bright yellow")tr.Material=Enum.Material.Neon tr.Transparency=0.3 D:AddItem(tr,0.15) if hp.Parent and hp.Parent:FindFirstChild("Humanoid")then local hm=hp.Parent.Humanoid if hm and hm.Health>0 then local dm=hs and w.Damage*w.HeadMulti or w.Damage if w.Explosive then dm=w.Damage local ex=Instance.new("Explosion",workspace)ex.Position=r.Position ex.BlastRadius=w.BlastRadius or 20 ex.BlastPressure=500000 end HE:FireServer(hp,dm,hs,w.Name) if hm.Health<=0 then kills=kills+1 ks=ks+1 lkt=tick() if hd then local st=hd.ScoreFrame.ScoreText if st then st.Text="KILLS: "..kills end local bn=hd.StreakBanner if bn then local sk={{2,"DOUBLE KILL!"},{3,"TRIPLE KILL!"},{5,"KILLING SPREE!"},{7,"UNSTOPPABLE!"},{10,"GODLIKE!"}}for _,s in ipairs(sk)do if ks==s[1]then bn.Text=s[2]bn.Visible=true task.delay(2,function()bn.Visible=false end)break end end end end KE:FireServer("EnemySoldier")end end end end ro=math.min(ro+w.Recoil,w.Recoil*5)so=math.min(so+w.Spread*0.5,w.Spread*3) if ammo[ci]<=0 then task.delay(0.3,function()if ammo[ci]<=0 and not isR then isR=true canS=false local ww=WD[ci]local hd=pl.PlayerGui:FindFirstChild("FPS_HUD")if hd then hd.ReloadBar.Visible=true hd.ReloadText.Visible=true local f=hd.ReloadBar.Fill f.Size=UDim2.new(0,0,1,0)TS:Create(f,TweenInfo.new(ww.ReloadTime),{Size=UDim2.new(1,0,1,0)}):Play()end task.delay(ww.ReloadTime,function()ammo[ci]=ww.MagSize isR=false canS=true local hd=pl.PlayerGui:FindFirstChild("FPS_HUD")if hd then hd.ReloadBar.Visible=false hd.ReloadText.Visible=false local at=hd.AmmoFrame.AmmoText if at then at.Text=ammo[ci].." / "..ww.MagSize end end end)end end)end end UI.InputBegan:Connect(function(i,g)if g then return end if i.UserInputType==Enum.UserInputType.MouseButton1 then holdM=true local w=WD[ci] if w.Auto then task.spawn(function()while holdM and canS do shoot()task.wait(w.FireRate)end end) elseif w.BurstCount then for b=1,w.BurstCount do shoot()task.wait(w.FireRate)end else shoot()end end end) UI.InputEnded:Connect(function(i)if i.UserInputType==Enum.UserInputType.MouseButton1 then holdM=false end end) RS.RenderStepped:Connect(function() ro=math.max(ro-0.15,0)so=math.max(so-0.01,0) if tick()-lkt>5 and ks>0 then ks=0 end end) sw(1)print("[WeaponController] 20 weapons loaded!") ]] print("WEAPON CONTROLLER DONE")