Files
ClaudeCode-Roblox-Studio-MCP/roblox-fps-p6-weapons.lua
Gemini AI 2065361e57 Add GTA city builder + background injection API for Roblox Studio
- inject_gta_city.py: Full GTA-style city with 20 buildings, roads, cars,
  street lights, traffic lights, trees, 15 human enemies with varied
  skin/clothing, and 10 COD weapons with visible gun models
- inject_bg.py: Background injection using SendMessage/PostMessage Win32 API
- inject_bg2.py: PostMessage approach targeting main window for WPF apps
- inject_cod_final.py: Working COD game injection (7-step sequential)
- cod_inject.py: Combined COD game builder with proper Studio launch
- roblox-fps-p1-p6: Split Lua scripts for multi-part injection

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-31 21:39:39 +04:00

61 lines
5.6 KiB
Lua

-- 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]<w.MagSize then isR=true canS=false
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(w.ReloadTime),{Size=UDim2.new(1,0,1,0)}):Play()end
task.delay(w.ReloadTime,function()ammo[ci]=w.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].." / "..w.MagSize end end end)end end end)
UI.InputEnded:Connect(function(i)if i.UserInputType==Enum.UserInputType.MouseButton2 then isA=false TS:Create(cam,TweenInfo.new(0.15),{FieldOfView=70}):Play()end end)
local function shoot()
local w=WD[ci]if not canS or isR then return end if ammo[ci]<=0 then return end
ammo[ci]=ammo[ci]-1
local hd=pl.PlayerGui:FindFirstChild("FPS_HUD")if hd then local at=hd.AmmoFrame.AmmoText if at then at.Text=ammo[ci].." / "..w.MagSize end end
local c=pl.Character if not c or not c:FindFirstChild("Head")then return end
local h=c.Head local sp=isA and w.ADS_Spread or w.Spread sp=sp+so
local ro2=(ms.Hit.Position-h.Position).Unit+Vector3.new((math.random()-0.5)*sp,(math.random()-0.5)*sp,(math.random()-0.5)*sp).Unit
local rp=RaycastParams.new()rp.FilterType=Enum.RaycastFilterType.Exclude rp.FilterDescendantsInstances={c}
local pe=w.Pellets or 1
for p=1,pe do
local d=ro2 if pe>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")