diff --git a/cod_inject.py b/cod_inject.py new file mode 100644 index 0000000..b486b1b --- /dev/null +++ b/cod_inject.py @@ -0,0 +1,329 @@ +""" +Build a complete Call of Duty game in Roblox Studio. +Uses small sequential injections that fit in command bar. +Part 1: New place + ground +""" +import ctypes, ctypes.wintypes, subprocess, time, sys, os + +user32 = ctypes.windll.user32 + +def find_studio(): + target = [None] + def cb(hwnd, _): + l = user32.GetWindowTextLengthW(hwnd) + if l > 0: + buf = ctypes.create_unicode_buffer(l + 1) + user32.GetWindowTextW(hwnd, buf, l + 1) + if "Roblox Studio" in buf.value: + target[0] = hwnd + return False + return True + WNDENUMPROC = ctypes.WINFUNCTYPE(ctypes.c_bool, ctypes.wintypes.HWND, ctypes.wintypes.LPARAM) + user32.EnumWindows(WNDENUMPROC(cb), 0) + return target[0] + +def focus(hwnd): + user32.ShowWindow(hwnd, 9) + time.sleep(0.3) + fg = user32.GetForegroundWindow() + if fg != hwnd: + tid_fg = user32.GetWindowThreadProcessId(fg, None) + tid_target = user32.GetWindowThreadProcessId(hwnd, None) + user32.AttachThreadInput(tid_fg, tid_target, True) + user32.SetForegroundWindow(hwnd) + user32.AttachThreadInput(tid_fg, tid_target, False) + time.sleep(0.5) + +def inject_code(code, hwnd): + """Inject Lua code into Studio command bar.""" + tmp = os.path.join(os.environ["TEMP"], "rbx_inj.lua") + with open(tmp, "w", encoding="utf-8") as f: + f.write(code) + subprocess.run(["powershell", "-Command", f"Get-Content '{tmp}' -Raw | Set-Clipboard"], + capture_output=True, timeout=15) + time.sleep(0.3) + + # Escape to dismiss any dialog + user32.keybd_event(0x1B, 0, 0, 0); time.sleep(0.03); user32.keybd_event(0x1B, 0, 2, 0) + time.sleep(0.2) + + # Click command bar area (bottom center of window) + rect = ctypes.wintypes.RECT() + user32.GetWindowRect(hwnd, ctypes.byref(rect)) + w = rect.right - rect.left + h = rect.bottom - rect.top + cx = rect.left + w // 2 + cy = rect.bottom - 45 + sw = user32.GetSystemMetrics(0); sh = user32.GetSystemMetrics(1) + nx = int(cx * 65535 / sw); ny = int(cy * 65535 / sh) + user32.mouse_event(0x8001, nx, ny, 0, 0); time.sleep(0.02) + user32.mouse_event(0x8002, nx, ny, 0, 0); time.sleep(0.03) + user32.mouse_event(0x8004, nx, ny, 0, 0) + time.sleep(0.4) + + # Select all + delete + user32.keybd_event(0x11, 0, 0, 0) # Ctrl + user32.keybd_event(0x41, 0, 0, 0); time.sleep(0.03); user32.keybd_event(0x41, 0, 2, 0) # A + user32.keybd_event(0x11, 0, 2, 0) + time.sleep(0.1) + user32.keybd_event(0x2E, 0, 0, 0); time.sleep(0.03); user32.keybd_event(0x2E, 0, 2, 0) # Del + time.sleep(0.1) + + # Paste (Ctrl+V) + user32.keybd_event(0x11, 0, 0, 0); time.sleep(0.02) + user32.keybd_event(0x56, 0, 0, 0); time.sleep(0.03); user32.keybd_event(0x56, 0, 2, 0) + time.sleep(0.02); user32.keybd_event(0x11, 0, 2, 0) + time.sleep(1.0) + + # Execute (Enter) + user32.keybd_event(0x0D, 0, 0, 0); time.sleep(0.03); user32.keybd_event(0x0D, 0, 2, 0) + time.sleep(1.5) + +hwnd = find_studio() +if not hwnd: + print("ERROR: Roblox Studio not found!") + sys.exit(1) + +print(f"Studio found: {hwnd}") +focus(hwnd) + +# Step 1: Open new place (Ctrl+N) +print("[1/8] Opening new place...") +user32.keybd_event(0x11, 0, 0, 0); time.sleep(0.02) +user32.keybd_event(0x4E, 0, 0, 0); time.sleep(0.03); user32.keybd_event(0x4E, 0, 2, 0) +time.sleep(0.02); user32.keybd_event(0x11, 0, 2, 0) +time.sleep(5) +focus(hwnd) + +# Step 2: Clean + build ground +print("[2/8] Building ground + lighting...") +code2 = """ +for _,v in pairs(workspace:GetChildren()) do if v:IsA("Model")or v:IsA("Part")or v:IsA("Folder")then if v.Name~="Camera"and v.Name~="Terrain"then v:Destroy()end end end +wait(0.2) +local g=Instance.new("Part",workspace)g.Name="Ground"g.Size=Vector3.new(500,2,500)g.Position=Vector3.new(0,-1,0)g.Anchored=true g.BrickColor=BrickColor.new("Dark stone grey")g.Material=Enum.Material.Asphalt +local L=game:GetService("Lighting")L.ClockTime=6 L.Brightness=0.4 L.FogEnd=600 L.FogStart=150 L.Ambient=Color3.fromRGB(60,60,80) +print("Ground done") +""" +inject_code(code2, hwnd) +print(" Ground OK") + +# Step 3: Buildings +print("[3/8] Building structures...") +code3 = """ +local blds={{-80,10,-100,35,22,28},{90,10,-70,28,18,32},{-50,11,80,40,24,22},{100,9,90,25,16,30},{0,13,-160,32,26,32},{-130,10,0,22,20,22},{130,10,-30,26,20,26}} +for i,b in ipairs(blds)do local m=Instance.new("Model",workspace)m.Name="Building"..i local p=Instance.new("Part",m)p.Size=Vector3.new(b[4],b[5],b[6])p.Position=Vector3.new(b[1],b[2],b[3])p.Anchored=true p.BrickColor=BrickColor.new(i%2==0 and"Medium stone grey"or"Brown")p.Material=Enum.Material.Brick p.Name="Wall"end +for _,w in ipairs({{-250,10,0,2,20,500},{250,10,0,2,20,500},{0,10,-250,500,20,2},{0,10,250,500,20,2}})do local p=Instance.new("Part",workspace)p.Size=Vector3.new(w[4],w[5],w[6])p.Position=Vector3.new(w[1],w[2],w[3])p.Anchored=true p.BrickColor=BrickColor.new("Dark stone grey")p.Material=Enum.Material.Concrete p.Transparency=0.4 p.Name="Boundary"end +print("Buildings done") +""" +inject_code(code3, hwnd) +print(" Buildings OK") + +# Step 4: Cover + towers +print("[4/8] Adding cover + watchtowers...") +code4 = """ +for i=1,30 do local x,z=math.random(-200,200),math.random(-200,200)local p=Instance.new("Part",workspace)p.Anchored=true p.Name="Cover"..i if i%3==0 then p.Size=Vector3.new(2,4,2)p.Position=Vector3.new(x,2,z)p.BrickColor=BrickColor.new("Reddish brown")p.Material=Enum.Material.Metal p.Shape=Enum.PartType.Cylinder elseif i%3==1 then p.Size=Vector3.new(4,4,4)p.Position=Vector3.new(x,2,z)p.BrickColor=BrickColor.new("Brown")p.Material=Enum.Material.Wood else p.Size=Vector3.new(7,2.5,3)p.Position=Vector3.new(x,1.25,z)p.BrickColor=BrickColor.new("Brick yellow")p.Material=Enum.Material.Sand end end +for i=1,4 do local x,z=({-180,-180,180,180})[i],({-180,180,-180,180})[i]local t=Instance.new("Model",workspace)t.Name="Tower"..i local b=Instance.new("Part",t)b.Size=Vector3.new(6,1,6)b.Position=Vector3.new(x,0.5,z)b.Anchored=true b.BrickColor=BrickColor.new("Dark stone grey")for _,o in ipairs({{-2,0,-2},{2,0,-2},{-2,0,2},{2,0,2}})do local l=Instance.new("Part",t)l.Size=Vector3.new(1,18,1)l.Position=Vector3.new(x+o[1],9,z+o[2])l.Anchored=true l.BrickColor=BrickColor.new("Dark stone grey")end local pl=Instance.new("Part",t)pl.Size=Vector3.new(8,1,8)pl.Position=Vector3.new(x,18,z)pl.Anchored=true pl.BrickColor=BrickColor.new("Brown")pl.Material=Enum.Material.Wood end +print("Cover done") +""" +inject_code(code4, hwnd) +print(" Cover OK") + +# Step 5: ReplicatedStorage + WeaponData +print("[5/8] Creating weapon system...") +code5 = """ +for _,v in pairs(game.ReplicatedStorage:GetChildren())do v:Destroy()end +local sh=Instance.new("Folder",game.ReplicatedStorage)sh.Name="Shared" +local ev=Instance.new("Folder",game.ReplicatedStorage)ev.Name="Events" +for _,n in ipairs({"HitEvent","KillEvent","DamageEvent","HitMarkerEvent"})do Instance.new("RemoteEvent",ev).Name=n end +local wd=Instance.new("ModuleScript",sh)wd.Name="WeaponData" +wd.Source=[[local W={ +{Name="M4A1",Cat="AR",Key=1,Dmg=28,HM=2.5,FR=0.09,MS=30,RL=2.2,Sp=0.02,ASp=0.007,Rec=0.3,Rng=350,Auto=true}, +{Name="AK-47",Cat="AR",Key=2,Dmg=32,HM=2.5,FR=0.11,MS=30,RL=2.5,Sp=0.03,ASp=0.012,Rec=0.45,Rng=300,Auto=true}, +{Name="SCAR-H",Cat="AR",Key=3,Dmg=38,HM=2.5,FR=0.1,MS=20,RL=2.6,Sp=0.022,ASp=0.009,Rec=0.4,Rng=400,Auto=true}, +{Name="ACR 6.8",Cat="AR",Key=4,Dmg=30,HM=2.5,FR=0.075,MS=30,RL=2.0,Sp=0.015,ASp=0.005,Rec=0.25,Rng=380,Auto=true}, +{Name="MP7",Cat="SMG",Key=5,Dmg=22,HM=2,FR=0.06,MS=40,RL=1.8,Sp=0.03,ASp=0.012,Rec=0.12,Rng=140,Auto=true}, +{Name="MP5",Cat="SMG",Key=6,Dmg=21,HM=2,FR=0.07,MS=30,RL=1.7,Sp=0.032,ASp=0.014,Rec=0.15,Rng=150,Auto=true}, +{Name="AWP",Cat="Sniper",Key=7,Dmg=120,HM=3,FR=1.5,MS=10,RL=3.5,Sp=0.001,ASp=0,Rec=2.5,Rng=900,Auto=false,Zoom=8}, +{Name="Intervention",Cat="Sniper",Key=8,Dmg=98,HM=3,FR=1.2,MS=5,RL=3.0,Sp=0.002,ASp=0,Rec=3.0,Rng=850,Auto=false,Zoom=10}, +{Name="SPAS-12",Cat="Shotgun",Key=9,Dmg=18,HM=1.5,FR=0.85,MS=8,RL=3.0,Sp=0.09,ASp=0.07,Rec=1.5,Rng=45,Auto=false,Pel=8}, +{Name="RPG-7",Cat="Launcher",Key=0,Dmg=250,HM=1,FR=2.5,MS=1,RL=4.5,Sp=0.01,ASp=0.005,Rec=3.5,Rng=250,Auto=false,Expl=true,Blast=25}, +}return W]] +print("WeaponData created with 10 weapons") +""" +inject_code(code5, hwnd) +print(" Weapons OK") + +# Step 6: Game Server Script +print("[6/8] Creating game server + enemy AI...") +code6 = """ +for _,v in pairs(game.ServerScriptService:GetChildren())do v:Destroy()end +local s=Instance.new("Script",game.ServerScriptService)s.Name="GameServer" +s.Source=[[ +local RS=game:GetService("ReplicatedStorage")local P=game:GetService("Players")local D=game:GetService("Debris") +local E=RS:WaitForChild("Events")local HE=E.HitEvent KE=E.KillEvent DE=E.DamageEvent HME=E.HitMarkerEvent +P.PlayerAdded:Connect(function(pl) +local ls=Instance.new("Folder",pl)ls.Name="leaderstats" +local k=Instance.new("IntValue",ls)k.Name="Kills"k.Value=0 +local d=Instance.new("IntValue",ls)d.Name="Deaths"d.Value=0 +pl.CharacterAdded:Connect(function(c)local h=c:WaitForChild("Humanoid")h.MaxHealth=100 h.Health=100 h.WalkSpeed=20 +h.Died:Connect(function()d.Value=d.Value+1 task.delay(4,function()if pl and pl.Parent then pl:LoadCharacter()end end)end)end)end) +HE.OnServerEvent:Connect(function(pl,hp,dmg,hs) +if hp and hp.Parent and hp.Parent:FindFirstChild("Humanoid")then local hm=hp.Parent.Humanoid +if hm and hm.Health>0 then local d=hs and dmg*2.5 or dmg hm:TakeDamage(d)HME:FireClient(pl,hs) +if hm.Health<=0 then KE:FireClient(pl,"Enemy")pl.leaderstats.Kills.Value=pl.leaderstats.Kills.Value+1 end end end end) +local SP={Vector3.new(-180,3,-180),Vector3.new(180,3,-180),Vector3.new(-180,3,180),Vector3.new(180,3,180),Vector3.new(0,3,-200),Vector3.new(0,3,200),Vector3.new(-200,3,0),Vector3.new(200,3,0),Vector3.new(-120,3,-120),Vector3.new(120,3,120),Vector3.new(0,3,0),Vector3.new(-60,3,60)} +local function mkE(sp) +local m=Instance.new("Model",workspace)m.Name="EnemyBot" +local t=Instance.new("Part",m)t.Name="Torso"t.Size=Vector3.new(3,3,2)t.Position=sp t.BrickColor=BrickColor.new("Dark olive green")t.Material=Enum.Material.Plastic +local h=Instance.new("Part",m)h.Name="Head"h.Size=Vector3.new(2,2,2)h.Position=sp+Vector3.new(0,2.5,0)h.BrickColor=BrickColor.new("Medium stone grey") +local ll=Instance.new("Part",m)ll.Name="Left Leg"ll.Size=Vector3.new(1,3,1)ll.Position=sp+Vector3.new(-.75,-2.5,0)ll.BrickColor=BrickColor.new("Dark olive green") +local rl=Instance.new("Part",m)rl.Name="Right Leg"rl.Size=Vector3.new(1,3,1)rl.Position=sp+Vector3.new(.75,-2.5,0)rl.BrickColor=BrickColor.new("Dark olive green") +local la=Instance.new("Part",m)la.Name="Left Arm"la.Size=Vector3.new(1,3,1)la.Position=sp+Vector3.new(-2,0,0)la.BrickColor=BrickColor.new("Dark olive green") +local ra=Instance.new("Part",m)ra.Name="Right Arm"ra.Size=Vector3.new(1,3,1)ra.Position=sp+Vector3.new(2,0,0)ra.BrickColor=BrickColor.new("Dark olive green") +local hm=Instance.new("Humanoid",m)hm.MaxHealth=100 hm.Health=100 hm.WalkSpeed=14 +local rp=Instance.new("Part",m)rp.Name="HumanoidRootPart"rp.Size=Vector3.new(2,2,1)rp.Position=sp rp.Transparency=1 rp.CanCollide=false +for _,a in ipairs({{rp,t},{t,h},{t,ll},{t,rl},{t,la},{t,ra}})do local w=Instance.new("Weld")w.Part0=a[1]w.Part1=a[2]w.Parent=a[1]end +local tp=SP[math.random(#SP)]local ls=0 +hm.Died:Connect(function()task.delay(6,function()if m.Parent then m:Destroy()end end)task.delay(15,function()mkE(SP[math.random(#SP)])end)end) +spawn(function()while m.Parent and hm.Health>0 do task.wait(.4)local r=m:FindFirstChild("HumanoidRootPart")if r then hm:MoveTo(tp)if(r.Position-tp).Magnitude<6 then tp=SP[math.random(#SP)]end end end end) +spawn(function()while m.Parent and hm.Health>0 do task.wait(.25)local r=m:FindFirstChild("HumanoidRootPart")if not r then continue end for _,pl in ipairs(P:GetPlayers())do if pl.Character and pl.Character:FindFirstChild("HumanoidRootPart")then local pr=pl.Character.HumanoidRootPart local d=(pr.Position-r.Position).Magnitude if d<70 then hm:MoveTo(pr.Position)if d<50 and tick()-ls>1.2 then ls=tick()local ph=pl.Character:FindFirstChild("Humanoid")if ph and ph.Health>0 then ph:TakeDamage(6+math.random(8))DE:FireClient(pl,8)end end end end end end end) +end +for i=1,12 do task.delay(i*.4,function()mkE(SP[i])end)end +print("[GameServer] 12 enemy bots spawned!") +]] +print("Server script created") +""" +inject_code(code6, hwnd) +print(" Server OK") + +# Step 7: HUD +print("[7/8] Creating HUD...") +code7 = """ +for _,v in pairs(game.StarterGui:GetChildren())do v:Destroy()end +local h=Instance.new("ScreenGui",game.StarterGui)h.Name="COD_HUD"h.ResetOnSpawn=false +-- Crosshair +local c1=Instance.new("Frame",h)c1.Name="CH"c1.Size=UDim2.new(0,24,0,2)c1.Position=UDim2.new(0.5,-12,0.5,-1)c1.BackgroundColor3=Color3.new(1,1,1)c1.BorderSizePixel=0 +local c2=Instance.new("Frame",h)c2.Name="CV"c2.Size=UDim2.new(0,2,0,24)c2.Position=UDim2.new(0.5,-1,0.5,-12)c2.BackgroundColor3=Color3.new(1,1,1)c2.BorderSizePixel=0 +-- Dot +local cd=Instance.new("Frame",h)cd.Name="CDot"cd.Size=UDim2.new(0,4,0,4)cd.Position=UDim2.new(0.5,-2,0.5,-2)cd.BackgroundColor3=Color3.fromRGB(255,50,50)cd.BorderSizePixel=0 +-- Health bar +local hf=Instance.new("Frame",h)hf.Name="HP_Frame"hf.Size=UDim2.new(0,260,0,32)hf.Position=UDim2.new(0,15,1,-55)hf.BackgroundColor3=Color3.fromRGB(0,0,0)hf.BackgroundTransparency=0.4 hf.BorderSizePixel=0 +local hfl=Instance.new("Frame",hf)hfl.Name="Fill"hfl.Size=UDim2.new(1,0,1,0)hfl.BackgroundColor3=Color3.fromRGB(0,180,0)hfl.BorderSizePixel=0 +local htx=Instance.new("TextLabel",hf)htx.Size=UDim2.new(1,0,1,0)htx.BackgroundTransparency=1 htx.TextColor3=Color3.new(1,1,1)htx.TextStrokeTransparency=0.5 htx.Font=Enum.Font.GothamBold htx.TextSize=16 htx.Text="100" +-- Ammo +local af=Instance.new("Frame",h)af.Name="Ammo_Frame"af.Size=UDim2.new(0,220,0,65)af.Position=UDim2.new(1,-235,1,-75)af.BackgroundTransparency=1 +local at=Instance.new("TextLabel",af)at.Name="AmmoTxt"at.Size=UDim2.new(1,0,0.6,0)at.BackgroundTransparency=1 at.TextColor3=Color3.new(1,1,1)at.TextStrokeTransparency=0.5 at.Font=Enum.Font.GothamBold at.TextSize=30 at.TextXAlignment=Enum.TextXAlignment.Right at.Text="30 | 30" +local wn=Instance.new("TextLabel",af)wn.Name="WepName"wn.Size=UDim2.new(1,0,0.4,0)wn.Position=UDim2.new(0,0,.6,0)wn.BackgroundTransparency=1 wn.TextColor3=Color3.fromRGB(180,180,180)wn.Font=Enum.Font.Gotham wn.TextSize=13 wn.TextXAlignment=Enum.TextXAlignment.Right wn.Text="M4A1" +-- Score +local sf=Instance.new("Frame",h)sf.Size=UDim2.new(0,180,0,36)sf.Position=UDim2.new(0.5,-90,0,8)sf.BackgroundColor3=Color3.fromRGB(0,0,0)sf.BackgroundTransparency=0.5 sf.BorderSizePixel=0 +local st=Instance.new("TextLabel",sf)st.Name="ScoreTxt"st.Size=UDim2.new(1,0,1,0)st.BackgroundTransparency=1 st.TextColor3=Color3.new(1,1,1)st.Font=Enum.Font.GothamBold st.TextSize=18 st.Text="KILLS: 0" +-- Kill feed +local kf=Instance.new("Frame",h)kf.Name="KillFeed"kf.Size=UDim2.new(0,240,0,180)kf.Position=UDim2.new(1,-250,0,8)kf.BackgroundTransparency=1 +Instance.new("UIListLayout",kf) +-- Hit marker +local hm=Instance.new("Frame",h)hm.Name="HitMark"hm.Size=UDim2.new(0,30,0,30)hm.Position=UDim2.new(0.5,-15,0.5,-15)hm.BackgroundTransparency=1 hm.Visible=false +for _,a in ipairs({{15,0,45},{0,15,45}})do local f=Instance.new("Frame",hm)f.Size=UDim2.new(0,14,0,3)f.Position=UDim2.new(0,a[1],0,a[2])f.Rotation=45 f.BackgroundColor3=Color3.new(1,1,1)f.BorderSizePixel=0 end +-- Reload bar +local rb=Instance.new("Frame",h)rb.Name="ReloadBar"rb.Size=UDim2.new(0,180,0,5)rb.Position=UDim2.new(0.5,-90,1,-100)rb.BackgroundColor3=Color3.fromRGB(50,50,50)rb.BorderSizePixel=0 rb.Visible=false rb.BackgroundTransparency=0.3 +local rf=Instance.new("Frame",rb)rf.Name="Fill"rf.Size=UDim2.new(0,0,1,0)rf.BackgroundColor3=Color3.fromRGB(255,200,0)rf.BorderSizePixel=0 +-- Weapon slots bar +local wb=Instance.new("Frame",h)wb.Name="WepBar"wb.Size=UDim2.new(0,400,0,28)wb.Position=UDim2.new(0.5,-200,1,-28)wb.BackgroundColor3=Color3.fromRGB(10,10,10)wb.BackgroundTransparency=0.5 wb.BorderSizePixel=0 +local slts={{"1-4 AR",100,150,255},{"5-6 SMG",100,255,100},{"7-8 SNIPER",255,80,80},{"9 SHOTGUN",255,200,50},{"0 RPG",255,130,50}} +for i,s in ipairs(slts)do local l=Instance.new("TextLabel",wb)l.Size=UDim2.new(1/#slts,0,1,0)l.Position=UDim2.new((i-1)/#slts,0,0,0)l.BackgroundColor3=Color3.fromRGB(s[2],s[3],s[4])l.BackgroundTransparency=0.6 l.TextColor3=Color3.new(1,1,1)l.Font=Enum.Font.GothamBold l.TextSize=10 l.Text=s[1]end +print("HUD created") +""" +inject_code(code7, hwnd) +print(" HUD OK") + +# Step 8: Player scripts +print("[8/8] Creating player controller + weapon system...") +code8 = """ +for _,v in pairs(game.StarterPlayer.StarterPlayerScripts:GetChildren())do v:Destroy()end +local ps=Instance.new("LocalScript",game.StarterPlayer.StarterPlayerScripts)ps.Name="PlayerSetup" +ps.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 pl=P.LocalPlayer cam=workspace.CurrentCamera +pl.CharacterAdded:Connect(function(c) +local h=c:WaitForChild("Humanoid")h.MaxHealth=100 h.Health=100 h.WalkSpeed=20 +RS.RenderStepped:Connect(function()if h.Health>0 then cam.CameraType=Enum.CameraType.LockFirstPerson local hd=c:FindFirstChild("Head")if hd then cam.CFrame=hd.CFrame end end end) +local sp,cr=false,false +UI.InputBegan:Connect(function(i,g)if g then return end +if i.KeyCode==Enum.KeyCode.LeftShift then sp=true h.WalkSpeed=32 elseif i.KeyCode==Enum.KeyCode.LeftControl then cr=true h.WalkSpeed=10 end end) +UI.InputEnded:Connect(function(i) +if i.KeyCode==Enum.KeyCode.LeftShift then sp=false h.WalkSpeed=cr and 10 or 20 elseif i.KeyCode==Enum.KeyCode.LeftControl then cr=false h.WalkSpeed=sp and 32 or 20 end end) +end) +]] +local wc=Instance.new("LocalScript",game.StarterPlayer.StarterPlayerScripts)wc.Name="WeaponCtrl" +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 cam=workspace.CurrentCamera ms=pl:GetMouse() +local E=RepS:WaitForChild("Events")local HE=E.HitEvent KE=E.KillEvent HME=E.HitMarkerEvent +local WD=require(RepS:WaitForChild("Shared"):WaitForChild("WeaponData")) +local ci=1 ammo={} isR=false isA=false canS=true ro=0 so=0 kills=0 holdM=false +for i,w in ipairs(WD)do ammo[i]=w.MS end +local km={}for i,w in ipairs(WD)do km[tostring(w.Key)]=i end +local function hud()return pl.PlayerGui:FindFirstChild("COD_HUD")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 h=hud()if h then h.Ammo_Frame.AmmoTxt.Text=ammo[ci].." | "..w.MS h.Ammo_Frame.WepName.Text=w.Name end end +UI.InputBegan:Connect(function(i,g)if g then return end +local kn=tostring(i.KeyCode.Value)if km[kn]then sw(km[kn])end +if i.UserInputType==Enum.UserInputType.MouseButton2 then local w=WD[ci] +if w.Zoom then isA=true cam.FieldOfView=70/w.Zoom else isA=true TS:Create(cam,TweenInfo.new(.15),{FieldOfView=50}):Play()end end +if i.KeyCode==Enum.KeyCode.R and not isR then local w=WD[ci]if ammo[ci]1 then d=dir+Vector3.new((math.random()-.5)*w.Sp*2,(math.random()-.5)*w.Sp*2,(math.random()-.5)*w.Sp*2).Unit end +local r=workspace:Raycast(hd.Position,d*w.Rng,rp) +if r then local hp=r.Instance local hs=hp.Name=="Head" +local tr=Instance.new("Part",workspace)tr.Size=Vector3.new(.1,.1,(r.Position-hd.Position).Magnitude)tr.CFrame=CFrame.lookAt(hd.Position,r.Position)*CFrame.new(0,0,-tr.Size.Z/2)tr.Anchored=true tr.CanCollide=false tr.BrickColor=BrickColor.new("New Yeller")tr.Material=Enum.Material.Neon tr.Transparency=.4 D:AddItem(tr,.12) +local sp2=Instance.new("Part",workspace)sp2.Size=Vector3.new(.3,.3,.3)sp2.Position=r.Position sp2.Anchored=true sp2.CanCollide=false sp2.BrickColor=BrickColor.new("Bright orange")sp2.Material=Enum.Material.Neon D:AddItem(sp2,.08) +if w.Expl then local ex=Instance.new("Explosion",workspace)ex.Position=r.Position ex.BlastRadius=w.Blast or 25 ex.BlastPressure=500000 end +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.Dmg*w.HM or w.Dmg HE:FireServer(hp,dm,hs) +if hm.Health<=0 then kills=kills+1 local h=hud()if h then h.ScoreFrame.ScoreTxt.Text="KILLS: "..kills end KE:FireServer("Enemy")end end end end end +ro=math.min(ro+w.Rec,w.Rec*5)so=math.min(so+w.Sp*.5,w.Sp*3) +if ammo[ci]<=0 then task.delay(.2,function()if ammo[ci]<=0 and not isR then isR=true canS=false local ww=WD[ci]local h=hud()if h then h.ReloadBar.Visible=true local f=h.ReloadBar.Fill f.Size=UDim2.new(0,0,1,0)TS:Create(f,TweenInfo.new(ww.RL),{Size=UDim2.new(1,0,1,0)}):Play()end +task.delay(ww.RL,function()ammo[ci]=ww.MS isR=false canS=true local h=hud()if h then h.ReloadBar.Visible=false h.Ammo_Frame.AmmoTxt.Text=ammo[ci].." | "..ww.MS 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 spawn(function()while holdM and canS do shoot()task.wait(w.FR)end end)elseif w.Burst then for b=1,w.Burst do shoot()task.wait(w.FR)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-.12,0)so=math.max(so-.008,0)end) +sw(1)print("[WeaponCtrl] 10 COD weapons loaded!") +]] +print("Player scripts created - GAME READY!") +""" +inject_code(code8, hwnd) +print(" Player scripts OK") + +# Final: Press F5 to start +print("\nStarting Play mode...") +time.sleep(1) +focus(hwnd) +user32.keybd_event(0x74, 0, 0, 0); time.sleep(0.05); user32.keybd_event(0x74, 0, 2, 0) + +print("\n" + "=" * 55) +print(" CALL OF DUTY - ROBLOX EDITION") +print(" 10 Weapons | 12 Enemy Bots | Urban Map") +print("=" * 55) +print(" CONTROLS:") +print(" WASD = Move LMB = Shoot RMB = ADS/Scope") +print(" Shift = Sprint Ctrl = Crouch R = Reload") +print("") +print(" WEAPONS:") +print(" 1 = M4A1 2 = AK-47 3 = SCAR-H") +print(" 4 = ACR 6.8 5 = MP7 6 = MP5") +print(" 7 = AWP 8 = Intervention 9 = SPAS-12") +print(" 0 = RPG-7") +print("=" * 55) diff --git a/inject_bg.py b/inject_bg.py new file mode 100644 index 0000000..80f5b92 --- /dev/null +++ b/inject_bg.py @@ -0,0 +1,214 @@ +""" +Background injection into Roblox Studio using SendMessage/PostMessage. +Works even when Studio is minimized or behind other windows. +Finds the command bar child control and sends text directly to it. +""" +import ctypes, ctypes.wintypes, subprocess, time, sys, os + +user32 = ctypes.windll.user32 +WM_SETTEXT = 0x000C +WM_KEYDOWN = 0x0100 +WM_KEYUP = 0x0101 +WM_CHAR = 0x0102 +EM_GETLINECOUNT = 0x00BA +EM_LINELENGTH = 0x00C1 + +def find_studio(): + target = [None] + def cb(hwnd, _): + l = user32.GetWindowTextLengthW(hwnd) + if l > 0: + buf = ctypes.create_unicode_buffer(l + 1) + user32.GetWindowTextW(hwnd, buf, l + 1) + if "Roblox Studio" in buf.value: + target[0] = hwnd + return False + return True + WNDENUMPROC = ctypes.WINFUNCTYPE(ctypes.c_bool, ctypes.wintypes.HWND, ctypes.wintypes.LPARAM) + user32.EnumWindows(WNDENUMPROC(cb), 0) + return target[0] + +def find_command_bar(parent_hwnd): + """Find the command bar edit control inside Studio.""" + result = [None] + WNDENUMPROC = ctypes.WINFUNCTYPE(ctypes.c_bool, ctypes.wintypes.HWND, ctypes.wintypes.LPARAM) + + def enum_children(hwnd, _): + # Check class name - Roblox command bar is typically an edit control + buf = ctypes.create_unicode_buffer(256) + user32.GetClassNameW(hwnd, buf, 256) + class_name = buf.value + + # Get control text + l = user32.GetWindowTextLengthW(hwnd) + if l > 0: + tbuf = ctypes.create_unicode_buffer(l + 1) + user32.GetWindowTextW(hwnd, tbuf, l + 1) + + # Look for edit controls or text input controls + # Roblox Studio uses WPF which hosts Win32 controls + rect = ctypes.wintypes.RECT() + user32.GetWindowRect(hwnd, ctypes.byref(rect)) + h = rect.bottom - rect.top + + # Command bar is a thin single-line edit at the bottom + if class_name in ("Edit", "TextBox", "WindowsForms10.Edit", "WpfTextEdit"): + if h > 10 and h < 60: + result[0] = hwnd + return False + + # Recurse into children + user32.EnumChildWindows(hwnd, WNDENUMPROC(enum_children), 0) + return True + + user32.EnumChildWindows(parent_hwnd, WNDENUMPROC(enum_children), 0) + return result[0] + +def find_all_children(parent_hwnd): + """List all child windows for debugging.""" + children = [] + WNDENUMPROC = ctypes.WINFUNCTYPE(ctypes.c_bool, ctypes.wintypes.HWND, ctypes.wintypes.LPARAM) + + def enum_children(hwnd, _): + buf = ctypes.create_unicode_buffer(256) + user32.GetClassNameW(hwnd, buf, 256) + class_name = buf.value + + l = user32.GetWindowTextLengthW(hwnd) + text = "" + if l > 0: + tbuf = ctypes.create_unicode_buffer(l + 1) + user32.GetWindowTextW(hwnd, tbuf, l + 1) + text = tbuf.value + + rect = ctypes.wintypes.RECT() + user32.GetWindowRect(hwnd, ctypes.byref(rect)) + w = rect.right - rect.left + h = rect.bottom - rect.top + + visible = user32.IsWindowVisible(hwnd) + enabled = user32.IsWindowEnabled(hwnd) + + children.append({ + 'hwnd': hwnd, + 'class': class_name, + 'text': text[:50], + 'size': f"{w}x{h}", + 'pos': f"({rect.left},{rect.top})", + 'visible': visible, + 'enabled': enabled + }) + return True + + user32.EnumChildWindows(parent_hwnd, WNDENUMPROC(enum_children), 0) + return children + +def inject_background(code, target_hwnd): + """Inject Lua code into a specific child control using SendMessage.""" + # Put code on clipboard + tmp = os.path.join(os.environ["TEMP"], "rbx.lua") + with open(tmp, "w", encoding="utf-8") as f: + f.write(code) + subprocess.run(["powershell", "-Command", f"Get-Content '{tmp}' -Raw | Set-Clipboard"], + capture_output=True, timeout=10) + time.sleep(0.2) + + # Send Ctrl+A (select all) then Ctrl+V (paste) then Enter via PostMessage + # PostMessage works on background windows + VK_CONTROL = 0x11 + VK_A = 0x41 + VK_V = 0x56 + VK_RETURN = 0x0D + + # Select all: Ctrl+A + user32.PostMessageW(target_hwnd, WM_KEYDOWN, VK_CONTROL, 0) + user32.PostMessageW(target_hwnd, WM_KEYDOWN, VK_A, 0) + time.sleep(0.02) + user32.PostMessageW(target_hwnd, WM_KEYUP, VK_A, 0) + user32.PostMessageW(target_hwnd, WM_KEYUP, VK_CONTROL, 0) + time.sleep(0.05) + + # Paste: Ctrl+V + user32.PostMessageW(target_hwnd, WM_KEYDOWN, VK_CONTROL, 0) + user32.PostMessageW(target_hwnd, WM_KEYDOWN, VK_V, 0) + time.sleep(0.02) + user32.PostMessageW(target_hwnd, WM_KEYUP, VK_V, 0) + user32.PostMessageW(target_hwnd, WM_KEYUP, VK_CONTROL, 0) + time.sleep(0.5) + + # Execute: Enter + user32.PostMessageW(target_hwnd, WM_KEYDOWN, VK_RETURN, 0) + time.sleep(0.02) + user32.PostMessageW(target_hwnd, WM_KEYUP, VK_RETURN, 0) + time.sleep(2) + +# ═══════════════════════════════════════ +# MAIN +# ═══════════════════════════════════════ +hwnd = find_studio() +if not hwnd: + print("ERROR: Roblox Studio not found!") + sys.exit(1) + +print(f"Studio window: {hwnd}") + +# List all child windows to find command bar +print("\nSearching for command bar control...") +children = find_all_children(hwnd) + +# Filter for likely candidates: visible, enabled, small height (thin bar), near bottom +print(f"Found {len(children)} child windows") + +# Get main window rect +main_rect = ctypes.wintypes.RECT() +user32.GetWindowRect(hwnd, ctypes.byref(main_rect)) +main_bottom = main_rect.bottom +main_top = main_rect.top + +# Find candidates near bottom of window, visible, reasonable size +candidates = [] +for c in children: + if not c['visible']: + continue + try: + h = int(c['size'].split('x')[1]) + w = int(c['size'].split('x')[0]) + except: + continue + if h < 5 or h > 80: + continue + if w < 100: + continue + # Parse position + pos = c['pos'].strip('()') + try: + y = int(pos.split(',')[1]) + except: + continue + # Check if near bottom of main window + if y > main_bottom - 100: + candidates.append(c) + print(f" CANDIDATE: hwnd={c['hwnd']} class={c['class']} text='{c['text']}' size={c['size']} pos={c['pos']}") + +if not candidates: + print("\nNo command bar candidates found. Listing ALL visible children near bottom:") + for c in children: + if not c['visible']: + continue + pos = c['pos'].strip('()') + try: + y = int(pos.split(',')[1]) + except: + continue + if y > main_bottom - 150: + print(f" hwnd={c['hwnd']} class={c['class']} text='{c['text']}' size={c['size']} pos={c['pos']}") + +# Try to test each candidate with a simple print +test_code = 'print("BG_INJECT_OK")' +print(f"\nTesting candidates with: {test_code}") + +for c in candidates: + target = c['hwnd'] + print(f"\n Trying hwnd={target} class={c['class']}...") + inject_background(test_code, target) + print(f" Sent to {target}. Check Studio Output for 'BG_INJECT_OK'") diff --git a/inject_bg2.py b/inject_bg2.py new file mode 100644 index 0000000..351ff57 --- /dev/null +++ b/inject_bg2.py @@ -0,0 +1,103 @@ +""" +Background injection v2 - PostMessage to main window. +Roblox Studio uses WPF (no standard child controls). +We send keystrokes via PostMessage to the main window handle. +This works even when Studio is minimized or behind other windows. +""" +import ctypes, ctypes.wintypes, subprocess, time, sys, os + +user32 = ctypes.windll.user32 +WM_KEYDOWN = 0x0100 +WM_KEYUP = 0x0101 +WM_CHAR = 0x0102 +WM_PASTE = 0x0302 + +def find_studio(): + target = [None] + def cb(hwnd, _): + l = user32.GetWindowTextLengthW(hwnd) + if l > 0: + buf = ctypes.create_unicode_buffer(l + 1) + user32.GetWindowTextW(hwnd, buf, l + 1) + if "Roblox Studio" in buf.value: + target[0] = hwnd + return False + return True + WNDENUMPROC = ctypes.WINFUNCTYPE(ctypes.c_bool, ctypes.wintypes.HWND, ctypes.wintypes.LPARAM) + user32.EnumWindows(WNDENUMPROC(cb), 0) + return target[0] + +def post_key(hwnd, vk, shift=False, ctrl=False): + """Send a key press/release via PostMessage to background window.""" + if ctrl: + user32.PostMessageW(hwnd, WM_KEYDOWN, 0x11, 0) + if shift: + user32.PostMessageW(hwnd, WM_KEYDOWN, 0x10, 0) + # Key down + scan = ctypes.windll.user32.MapVirtualKeyW(vk, 0) + lparam_down = (scan << 16) | 1 + user32.PostMessageW(hwnd, WM_KEYDOWN, vk, lparam_down) + time.sleep(0.01) + # Key up + lparam_up = (scan << 16) | 1 | (1 << 30) | (1 << 31) + user32.PostMessageW(hwnd, WM_KEYUP, vk, lparam_up) + time.sleep(0.01) + if ctrl: + user32.PostMessageW(hwnd, WM_KEYUP, 0x11, 0) + if shift: + user32.PostMessageW(hwnd, WM_KEYUP, 0x10, 0) + +def paste_and_run(hwnd, code): + """Copy code to clipboard, then send Ctrl+A, Ctrl+V, Enter via PostMessage.""" + tmp = os.path.join(os.environ["TEMP"], "rbx.lua") + with open(tmp, "w", encoding="utf-8") as f: + f.write(code) + subprocess.run(["powershell", "-Command", f"Get-Content '{tmp}' -Raw | Set-Clipboard"], + capture_output=True, timeout=10) + time.sleep(0.3) + + # Select all: Ctrl+A + user32.PostMessageW(hwnd, WM_KEYDOWN, 0x11, 0) # Ctrl down + time.sleep(0.02) + scan_a = user32.MapVirtualKeyW(0x41, 0) + user32.PostMessageW(hwnd, WM_KEYDOWN, 0x41, (scan_a << 16) | 1) + time.sleep(0.02) + user32.PostMessageW(hwnd, WM_KEYUP, 0x41, (scan_a << 16) | 1 | (1 << 30) | (1 << 31)) + time.sleep(0.02) + user32.PostMessageW(hwnd, WM_KEYUP, 0x11, 0) # Ctrl up + time.sleep(0.1) + + # Paste: Ctrl+V + user32.PostMessageW(hwnd, WM_KEYDOWN, 0x11, 0) + time.sleep(0.02) + scan_v = user32.MapVirtualKeyW(0x56, 0) + user32.PostMessageW(hwnd, WM_KEYDOWN, 0x56, (scan_v << 16) | 1) + time.sleep(0.02) + user32.PostMessageW(hwnd, WM_KEYUP, 0x56, (scan_v << 16) | 1 | (1 << 30) | (1 << 31)) + time.sleep(0.02) + user32.PostMessageW(hwnd, WM_KEYUP, 0x11, 0) + time.sleep(0.8) + + # Enter to execute + scan_enter = user32.MapVirtualKeyW(0x0D, 0) + user32.PostMessageW(hwnd, WM_KEYDOWN, 0x0D, (scan_enter << 16) | 1) + time.sleep(0.02) + user32.PostMessageW(hwnd, WM_KEYUP, 0x0D, (scan_enter << 16) | 1 | (1 << 30) | (1 << 31)) + time.sleep(2) + +# ═══════════════════════════════════════ +hwnd = find_studio() +if not hwnd: + print("ERROR: Roblox Studio not found!") + sys.exit(1) + +print(f"Studio: {hwnd}") +state = "minimized" if user32.IsIconic(hwnd) else ("background" if user32.GetForegroundWindow() != hwnd else "foreground") +print(f"Window state: {state}") + +# Test with simple code +print("\nTest: sending print('BG_TEST_OK') via PostMessage...") +paste_and_run(hwnd, """print("BG_TEST_OK - BACKGROUND INJECTION WORKS!")""") +print("Sent! Check Studio Output window (F9) for the message.") +print("\nNOTE: If nothing appeared, the command bar needs focus first.") +print("Alternative: bring Studio to front briefly, inject, then let it go to background.") diff --git a/inject_cod_final.py b/inject_cod_final.py new file mode 100644 index 0000000..ef7ce17 --- /dev/null +++ b/inject_cod_final.py @@ -0,0 +1,208 @@ +""" +Fast COD game injection - command bar is already focused. +Uses paste for speed. Each step is a separate injection. +""" +import ctypes, ctypes.wintypes, subprocess, time, sys, os + +user32 = ctypes.windll.user32 + +def key_down(vk): user32.keybd_event(vk, 0, 0, 0) +def key_up(vk): user32.keybd_event(vk, 0, 2, 0) +def press(vk): key_down(vk); time.sleep(0.02); key_up(vk) + +def paste_execute(code): + tmp = os.path.join(os.environ["TEMP"], "rbx.lua") + with open(tmp, "w", encoding="utf-8") as f: + f.write(code) + subprocess.run(["powershell", "-Command", f"Get-Content '{tmp}' -Raw | Set-Clipboard"], capture_output=True, timeout=10) + time.sleep(0.2) + # Select all + key_down(0x11); key_down(0x41); time.sleep(0.02); key_up(0x41); key_up(0x11) + time.sleep(0.05) + # Paste + key_down(0x11); key_down(0x56); time.sleep(0.02); key_up(0x56); key_up(0x11) + time.sleep(0.8) + # Execute + press(0x0D) + time.sleep(2) + +# Bring Studio to front +def find_studio(): + target = [None] + def cb(hwnd, _): + l = user32.GetWindowTextLengthW(hwnd) + if l > 0: + buf = ctypes.create_unicode_buffer(l + 1) + user32.GetWindowTextW(hwnd, buf, l + 1) + if "Roblox Studio" in buf.value: + target[0] = hwnd + return False + return True + WNDENUMPROC = ctypes.WINFUNCTYPE(ctypes.c_bool, ctypes.wintypes.HWND, ctypes.wintypes.LPARAM) + user32.EnumWindows(WNDENUMPROC(cb), 0) + return target[0] + +hwnd = find_studio() +if not hwnd: + print("Studio not found!"); sys.exit(1) +user32.ShowWindow(hwnd, 9); time.sleep(0.3) +user32.SetForegroundWindow(hwnd); time.sleep(0.3) + +# ============ STEP 1: Clean + Ground + Lighting ============ +print("[1/7] Ground + lighting...") +paste_execute("""for _,v in pairs(workspace:GetChildren()) do if v:IsA("Model")or v:IsA("Part")or v:IsA("Folder")then if v.Name~="Camera"and v.Name~="Terrain"then v:Destroy()end end end +for _,v in pairs(game.ServerScriptService:GetChildren())do v:Destroy()end +for _,v in pairs(game.StarterGui:GetChildren())do v:Destroy()end +for _,v in pairs(game.StarterPlayer.StarterPlayerScripts:GetChildren())do v:Destroy()end +for _,v in pairs(game.ReplicatedStorage:GetChildren())do v:Destroy()end +wait(0.2) +local g=Instance.new("Part",workspace)g.Name="Ground"g.Size=Vector3.new(500,2,500)g.Position=Vector3.new(0,-1,0)g.Anchored=true g.BrickColor=BrickColor.new("Dark stone grey")g.Material=Enum.Material.Asphalt +local L=game:GetService("Lighting")L.ClockTime=6 L.Brightness=0.3 L.FogEnd=500 L.FogStart=100 L.Ambient=Color3.fromRGB(50,50,70) L.OutdoorAmbient=Color3.fromRGB(40,40,60) +print("STEP1 DONE")""") + +# ============ STEP 2: Buildings + Cover ============ +print("[2/7] Buildings + cover...") +paste_execute("""local blds={{-80,10,-100,35,22,28},{90,10,-70,28,18,32},{-50,11,80,40,24,22},{100,9,90,25,16,30},{0,13,-160,32,26,32},{-130,10,0,22,20,22},{130,10,-30,26,20,26}} +for i,b in ipairs(blds)do local m=Instance.new("Model",workspace)m.Name="Building"..i local p=Instance.new("Part",m)p.Size=Vector3.new(b[4],b[5],b[6])p.Position=Vector3.new(b[1],b[2],b[3])p.Anchored=true p.BrickColor=BrickColor.new(i%2==0 and"Medium stone grey"or"Brown")p.Material=Enum.Material.Brick end +for i=1,30 do local x,z=math.random(-200,200),math.random(-200,200)local p=Instance.new("Part",workspace)p.Anchored=true p.Name="Cover"..i if i%3==0 then p.Size=Vector3.new(2,4,2)p.Position=Vector3.new(x,2,z)p.BrickColor=BrickColor.new("Reddish brown")p.Material=Enum.Material.Metal p.Shape=Enum.PartType.Cylinder elseif i%3==1 then p.Size=Vector3.new(4,4,4)p.Position=Vector3.new(x,2,z)p.BrickColor=BrickColor.new("Brown")p.Material=Enum.Material.Wood else p.Size=Vector3.new(7,2.5,3)p.Position=Vector3.new(x,1.25,z)p.BrickColor=BrickColor.new("Brick yellow")p.Material=Enum.Material.Sand end end +for i=1,4 do local x,z=({-180,-180,180,180})[i],({-180,180,-180,180})[i]local t=Instance.new("Model",workspace)t.Name="Tower"..i for _,o in ipairs({{-2,0,-2},{2,0,-2},{-2,0,2},{2,0,2}})do local l=Instance.new("Part",t)l.Size=Vector3.new(1,18,1)l.Position=Vector3.new(x+o[1],9,z+o[2])l.Anchored=true l.BrickColor=BrickColor.new("Dark stone grey")end local pl=Instance.new("Part",t)pl.Size=Vector3.new(8,1,8)pl.Position=Vector3.new(x,18,z)pl.Anchored=true pl.BrickColor=BrickColor.new("Brown")pl.Material=Enum.Material.Wood end +print("STEP2 DONE")""") + +# ============ STEP 3: WeaponData + Events ============ +print("[3/7] Weapons + events...") +paste_execute("""local sh=Instance.new("Folder",game.ReplicatedStorage)sh.Name="Shared" +local ev=Instance.new("Folder",game.ReplicatedStorage)ev.Name="Events" +for _,n in ipairs({"HitEvent","KillEvent","DamageEvent","HitMarkerEvent"})do Instance.new("RemoteEvent",ev).Name=n end +local wd=Instance.new("ModuleScript",sh)wd.Name="WeaponData" +wd.Source=[[local W={n="M4A1",d=28,h=2.5,f=0.09,m=30,r=2.2,s=0.02,a=0.007,rc=0.3,rng=350,auto=true},{n="AK-47",d=32,h=2.5,f=0.11,m=30,r=2.5,s=0.03,a=0.012,rc=0.45,rng=300,auto=true},{n="SCAR-H",d=38,h=2.5,f=0.1,m=20,r=2.6,s=0.022,a=0.009,rc=0.4,rng=400,auto=true},{n="ACR 6.8",d=30,h=2.5,f=0.075,m=30,r=2,s=0.015,a=0.005,rc=0.25,rng=380,auto=true},{n="MP7",d=22,h=2,f=0.06,m=40,r=1.8,s=0.03,a=0.012,rc=0.12,rng=140,auto=true},{n="MP5",d=21,h=2,f=0.07,m=30,r=1.7,s=0.032,a=0.014,rc=0.15,rng=150,auto=true},{n="AWP",d=120,h=3,f=1.5,m=10,r=3.5,s=0.001,a=0,rc=2.5,rng=900,auto=false,zm=8},{n="Intervention",d=98,h=3,f=1.2,m=5,r=3,s=0.002,a=0,rc=3,rng=850,auto=false,zm=10},{n="SPAS-12",d=18,h=1.5,f=0.85,m=8,r=3,s=0.09,a=0.07,rc=1.5,rng=45,auto=false,pel=8},{n="RPG-7",d=250,h=1,f=2.5,m=1,r=4.5,s=0.01,a=0.005,rc=3.5,rng=250,auto=false,expl=true,bl=25},}return W]] +print("STEP3 DONE")""") + +# ============ STEP 4: Game Server + Enemy AI ============ +print("[4/7] Game server + enemy AI...") +paste_execute("""local s=Instance.new("Script",game.ServerScriptService)s.Name="GameServer" +s.Source=[[ +local RS=game.ReplicatedStorage local P=game.Players local D=game.Debris +local E=RS:WaitForChild("Events") local HE=E.HitEvent KE=E.KillEvent DE=E.DamageEvent HME=E.HitMarkerEvent +P.PlayerAdded:Connect(function(pl) +local ls=Instance.new("Folder",pl)ls.Name="leaderstats" +local k=Instance.new("IntValue",ls)k.Name="Kills"k.Value=0 +local d=Instance.new("IntValue",ls)d.Name="Deaths"d.Value=0 +pl.CharacterAdded:Connect(function(c)local h=c:WaitForChild("Humanoid")h.MaxHealth=100 h.Health=100 h.WalkSpeed=20 +h.Died:Connect(function()d.Value=d.Value+1 task.delay(4,function()if pl and pl.Parent then pl:LoadCharacter()end end)end)end)end) +HE.OnServerEvent:Connect(function(pl,hp,dmg,hs) +if hp and hp.Parent and hp.Parent:FindFirstChild("Humanoid")then local hm=hp.Parent.Humanoid +if hm and hm.Health>0 then local d=hs and dmg*2.5 or dmg hm:TakeDamage(d)HME:FireClient(pl,hs) +if hm.Health<=0 then KE:FireClient(pl,"Enemy")pl.leaderstats.Kills.Value=pl.leaderstats.Kills.Value+1 end end end end) +local SP={Vector3.new(-180,3,-180),Vector3.new(180,3,-180),Vector3.new(-180,3,180),Vector3.new(180,3,180),Vector3.new(0,3,-200),Vector3.new(0,3,200),Vector3.new(-200,3,0),Vector3.new(200,3,0),Vector3.new(-120,3,-120),Vector3.new(120,3,120),Vector3.new(0,3,0),Vector3.new(-60,3,60)} +local function mkE(sp) +local m=Instance.new("Model",workspace)m.Name="EnemyBot" +local t=Instance.new("Part",m)t.Name="Torso"t.Size=Vector3.new(3,3,2)t.Position=sp t.BrickColor=BrickColor.new("Dark olive green")t.Material=Enum.Material.Plastic +local hd=Instance.new("Part",m)hd.Name="Head"hd.Size=Vector3.new(2,2,2)hd.Position=sp+Vector3.new(0,2.5,0)hd.BrickColor=BrickColor.new("Medium stone grey") +for _,n in ipairs({"Left Leg","Right Leg","Left Arm","Right Arm"})do local p=Instance.new("Part",m)p.Name=n p.Size=Vector3.new(1,3,1)p.BrickColor=BrickColor.new("Dark olive green")end +m["Left Leg"].Position=sp+Vector3.new(-.75,-2.5,0)m["Right Leg"].Position=sp+Vector3.new(.75,-2.5,0) +m["Left Arm"].Position=sp+Vector3.new(-2,0,0)m["Right Arm"].Position=sp+Vector3.new(2,0,0) +local hm=Instance.new("Humanoid",m)hm.MaxHealth=100 hm.Health=100 hm.WalkSpeed=14 +local rp=Instance.new("Part",m)rp.Name="HumanoidRootPart"rp.Size=Vector3.new(2,2,1)rp.Position=sp rp.Transparency=1 rp.CanCollide=false +for _,a in ipairs({{rp,t},{t,hd},{t,m["Left Leg"]},{t,m["Right Leg"]},{t,m["Left Arm"]},{t,m["Right Arm"]}})do local w=Instance.new("Weld")w.Part0=a[1]w.Part1=a[2]w.Parent=a[1]end +local tp=SP[math.random(#SP)]local ls=0 +hm.Died:Connect(function()task.delay(6,function()if m.Parent then m:Destroy()end end)task.delay(15,function()mkE(SP[math.random(#SP)])end)end) +spawn(function()while m.Parent and hm.Health>0 do task.wait(.4)local r=m:FindFirstChild("HumanoidRootPart")if r then hm:MoveTo(tp)if(r.Position-tp).Magnitude<6 then tp=SP[math.random(#SP)]end end end end) +spawn(function()while m.Parent and hm.Health>0 do task.wait(.25)local r=m:FindFirstChild("HumanoidRootPart")if not r then continue end for _,pl in ipairs(P:GetPlayers())do if pl.Character and pl.Character:FindFirstChild("HumanoidRootPart")then local pr=pl.Character.HumanoidRootPart local d=(pr.Position-r.Position).Magnitude if d<70 then hm:MoveTo(pr.Position)if d<50 and tick()-ls>1.2 then ls=tick()local ph=pl.Character:FindFirstChild("Humanoid")if ph and ph.Health>0 then ph:TakeDamage(6+math.random(8))DE:FireClient(pl,8)end end end end end end end) +end +for i=1,12 do task.delay(i*.4,function()mkE(SP[i])end)end +]] +print("STEP4 DONE")""") + +# ============ STEP 5: HUD ============ +print("[5/7] HUD...") +paste_execute("""local h=Instance.new("ScreenGui",game.StarterGui)h.Name="COD_HUD"h.ResetOnSpawn=false +local c1=Instance.new("Frame",h)c1.Name="CH"c1.Size=UDim2.new(0,24,0,2)c1.Position=UDim2.new(0.5,-12,0.5,-1)c1.BackgroundColor3=Color3.new(1,1,1)c1.BorderSizePixel=0 +local c2=Instance.new("Frame",h)c2.Name="CV"c2.Size=UDim2.new(0,2,0,24)c2.Position=UDim2.new(0.5,-1,0.5,-12)c2.BackgroundColor3=Color3.new(1,1,1)c2.BorderSizePixel=0 +local cd=Instance.new("Frame",h)cd.Name="CDot"cd.Size=UDim2.new(0,4,0,4)cd.Position=UDim2.new(0.5,-2,0.5,-2)cd.BackgroundColor3=Color3.fromRGB(255,50,50)cd.BorderSizePixel=0 +local hf=Instance.new("Frame",h)hf.Name="HP_Frame"hf.Size=UDim2.new(0,260,0,32)hf.Position=UDim2.new(0,15,1,-55)hf.BackgroundColor3=Color3.fromRGB(0,0,0)hf.BackgroundTransparency=0.4 hf.BorderSizePixel=0 +local hfl=Instance.new("Frame",hf)hfl.Name="Fill"hfl.Size=UDim2.new(1,0,1,0)hfl.BackgroundColor3=Color3.fromRGB(0,180,0)hfl.BorderSizePixel=0 +local htx=Instance.new("TextLabel",hf)htx.Size=UDim2.new(1,0,1,0)htx.BackgroundTransparency=1 htx.TextColor3=Color3.new(1,1,1)htx.TextStrokeTransparency=0.5 htx.Font=Enum.Font.GothamBold htx.TextSize=16 htx.Text="100" +local af=Instance.new("Frame",h)af.Name="Ammo_Frame"af.Size=UDim2.new(0,220,0,65)af.Position=UDim2.new(1,-235,1,-75)af.BackgroundTransparency=1 +local at=Instance.new("TextLabel",af)at.Name="AmmoTxt"at.Size=UDim2.new(1,0,0.6,0)at.BackgroundTransparency=1 at.TextColor3=Color3.new(1,1,1)at.TextStrokeTransparency=0.5 at.Font=Enum.Font.GothamBold at.TextSize=30 at.TextXAlignment=Enum.TextXAlignment.Right at.Text="30 | 30" +local wn=Instance.new("TextLabel",af)wn.Name="WepName"wn.Size=UDim2.new(1,0,0.4,0)wn.Position=UDim2.new(0,0,.6,0)wn.BackgroundTransparency=1 wn.TextColor3=Color3.fromRGB(180,180,180)wn.Font=Enum.Font.Gotham wn.TextSize=13 wn.TextXAlignment=Enum.TextXAlignment.Right wn.Text="M4A1" +local sf=Instance.new("Frame",h)sf.Name="ScoreFrame"sf.Size=UDim2.new(0,180,0,36)sf.Position=UDim2.new(0.5,-90,0,8)sf.BackgroundColor3=Color3.fromRGB(0,0,0)sf.BackgroundTransparency=0.5 sf.BorderSizePixel=0 +local st=Instance.new("TextLabel",sf)st.Name="ScoreTxt"st.Size=UDim2.new(1,0,1,0)st.BackgroundTransparency=1 st.TextColor3=Color3.new(1,1,1)st.Font=Enum.Font.GothamBold st.TextSize=18 st.Text="KILLS: 0" +local kf=Instance.new("Frame",h)kf.Name="KillFeed"kf.Size=UDim2.new(0,240,0,180)kf.Position=UDim2.new(1,-250,0,8)kf.BackgroundTransparency=1 Instance.new("UIListLayout",kf) +local hm=Instance.new("Frame",h)hm.Name="HitMark"hm.Size=UDim2.new(0,30,0,30)hm.Position=UDim2.new(0.5,-15,0.5,-15)hm.BackgroundTransparency=1 hm.Visible=false +for _,a in ipairs({{15,0,45},{0,15,45}})do local f=Instance.new("Frame",hm)f.Size=UDim2.new(0,14,0,3)f.Position=UDim2.new(0,a[1],0,a[2])f.Rotation=45 f.BackgroundColor3=Color3.new(1,1,1)f.BorderSizePixel=0 end +local rb=Instance.new("Frame",h)rb.Name="ReloadBar"rb.Size=UDim2.new(0,180,0,5)rb.Position=UDim2.new(0.5,-90,1,-100)rb.BackgroundColor3=Color3.fromRGB(50,50,50)rb.BorderSizePixel=0 rb.Visible=false rb.BackgroundTransparency=0.3 +Instance.new("Frame",rb).Name="Fill"Instance.new("Frame",rb).Fill.Size=UDim2.new(0,0,1,0)Instance.new("Frame",rb).Fill.BackgroundColor3=Color3.fromRGB(255,200,0) +local wb=Instance.new("Frame",h)wb.Name="WepBar"wb.Size=UDim2.new(0,400,0,28)wb.Position=UDim2.new(0.5,-200,1,-28)wb.BackgroundColor3=Color3.fromRGB(10,10,10)wb.BackgroundTransparency=0.5 wb.BorderSizePixel=0 +for i,s in ipairs({{"1-4 AR",100,150,255},{"5-6 SMG",100,255,100},{"7-8 SNIPER",255,80,80},{"9 SHOTGUN",255,200,50},{"0 RPG",255,130,50}})do local l=Instance.new("TextLabel",wb)l.Size=UDim2.new(0.2,0,1,0)l.Position=UDim2.new((i-1)*0.2,0,0,0)l.BackgroundColor3=Color3.fromRGB(s[2],s[3],s[4])l.BackgroundTransparency=0.6 l.TextColor3=Color3.new(1,1,1)l.Font=Enum.Font.GothamBold l.TextSize=10 l.Text=s[1]end +print("STEP5 DONE")""") + +# ============ STEP 6: Player Setup ============ +print("[6/7] Player setup...") +paste_execute("""local ps=Instance.new("LocalScript",game.StarterPlayer.StarterPlayerScripts)ps.Name="PlayerSetup" +ps.Source=[[local P=game.Players local RS=game.RunService local UI=game.UserInputService local pl=P.LocalPlayer cam=workspace.CurrentCamera +pl.CharacterAdded:Connect(function(c)local h=c:WaitForChild("Humanoid")h.MaxHealth=100 h.Health=100 h.WalkSpeed=20 +RS.RenderStepped:Connect(function()if h.Health>0 then cam.CameraType=Enum.CameraType.LockFirstPerson local hd=c:FindFirstChild("Head")if hd then cam.CFrame=hd.CFrame end end end) +local sp,cr=false,false +UI.InputBegan:Connect(function(i,g)if g then return end if i.KeyCode==Enum.KeyCode.LeftShift then sp=true h.WalkSpeed=32 elseif i.KeyCode==Enum.KeyCode.LeftControl then cr=true h.WalkSpeed=10 end end) +UI.InputEnded:Connect(function(i)if i.KeyCode==Enum.KeyCode.LeftShift then sp=false h.WalkSpeed=cr and 10 or 20 elseif i.KeyCode==Enum.KeyCode.LeftControl then cr=false h.WalkSpeed=sp and 32 or 20 end end)end) +]] +print("STEP6 DONE")""") + +# ============ STEP 7: Weapon Controller ============ +print("[7/7] Weapon controller...") +paste_execute("""local wc=Instance.new("LocalScript",game.StarterPlayer.StarterPlayerScripts)wc.Name="WeaponCtrl" +wc.Source=[[ +local P=game.Players local RS=game.RunService local UI=game.UserInputService local RepS=game.ReplicatedStorage local TS=game.TweenService local D=game.Debris +local pl=P.LocalPlayer cam=workspace.CurrentCamera ms=pl:GetMouse() +local E=RepS:WaitForChild("Events")local HE=E.HitEvent KE=E.KillEvent HME=E.HitMarkerEvent +local WD=require(RepS:WaitForChild("Shared"):WaitForChild("WeaponData")) +local ci=1 ammo={} isR=false isA=false canS=true ro=0 so=0 kills=0 holdM=false +for i,w in ipairs(WD)do ammo[i]=w.m end +local function hud()return pl.PlayerGui:FindFirstChild("COD_HUD")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 h=hud()if h then h.Ammo_Frame.AmmoTxt.Text=ammo[ci].." | "..w.m h.Ammo_Frame.WepName.Text=w.n end end +UI.InputBegan:Connect(function(i,g)if g then return end +if i.KeyCode.Value>=48 and i.KeyCode.Value<=57 then local idx=i.KeyCode.Value-47 if idx>0 and idx<=10 then sw(idx==10 and 10 or idx)end end +if i.UserInputType==Enum.UserInputType.MouseButton2 then local w=WD[ci]if w.zm then isA=true cam.FieldOfView=70/w.zm else isA=true TS:Create(cam,TweenInfo.new(.15),{FieldOfView=50}):Play()end end +if i.KeyCode==Enum.KeyCode.R and not isR then local w=WD[ci]if ammo[ci]1 then d=dir+Vector3.new((math.random()-.5)*w.s*2,(math.random()-.5)*w.s*2,(math.random()-.5)*w.s*2).Unit end +local r=workspace:Raycast(hd.Position,d*w.rng,rp) +if r then local hp=r.Instance local hs=hp.Name=="Head" +local tr=Instance.new("Part",workspace)tr.Size=Vector3.new(.1,.1,(r.Position-hd.Position).Magnitude)tr.CFrame=CFrame.lookAt(hd.Position,r.Position)*CFrame.new(0,0,-tr.Size.Z/2)tr.Anchored=true tr.CanCollide=false tr.BrickColor=BrickColor.new("New Yeller")tr.Material=Enum.Material.Neon tr.Transparency=.4 D:AddItem(tr,.12) +if w.expl then local ex=Instance.new("Explosion",workspace)ex.Position=r.Position ex.BlastRadius=w.bl or 25 ex.BlastPressure=500000 end +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.d*w.h or w.d HE:FireServer(hp,dm,hs) +if hm.Health<=0 then kills=kills+1 local h=hud()if h then h.ScoreFrame.ScoreTxt.Text="KILLS: "..kills end KE:FireServer("Enemy")end end end end end +ro=math.min(ro+w.rc,w.rc*5)so=math.min(so+w.s*.5,w.s*3) +if ammo[ci]<=0 then task.delay(.2,function()if ammo[ci]<=0 and not isR then isR=true canS=false local ww=WD[ci]local h=hud()if h then h.ReloadBar.Visible=true local f=h.ReloadBar.Fill f.Size=UDim2.new(0,0,1,0)TS:Create(f,TweenInfo.new(ww.r),{Size=UDim2.new(1,0,1,0)}):Play()end task.delay(ww.r,function()ammo[ci]=ww.m isR=false canS=true local h=hud()if h then h.ReloadBar.Visible=false h.Ammo_Frame.AmmoTxt.Text=ammo[ci].." | "..ww.m 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 spawn(function()while holdM and canS do shoot()task.wait(w.f)end 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-.12,0)so=math.max(so-.008,0)end) +sw(1)print("[WeaponCtrl] 10 COD weapons loaded!") +]] +print("STEP7 DONE - ALL INJECTED!") +""") + +# ============ PRESS F5 ============ +print("\nStarting Play mode (F5)...") +time.sleep(1) +press(0x74) # F5 + +print("\n" + "=" * 50) +print(" CALL OF DUTY - ROBLOX EDITION LOADED!") +print("=" * 50) +print(" WASD=Move LMB=Shoot RMB=ADS R=Reload") +print(" Shift=Sprint Ctrl=Crouch") +print(" 1=M4A1 2=AK-47 3=SCAR-H 4=ACR 5=MP7") +print(" 6=MP5 7=AWP 8=Intervention 9=SPAS 0=RPG") +print("=" * 50) diff --git a/inject_gta_city.py b/inject_gta_city.py new file mode 100644 index 0000000..f32625c --- /dev/null +++ b/inject_gta_city.py @@ -0,0 +1,346 @@ +""" +GTA City Expansion + Visible Weapons + Human Enemies +Inject into Roblox Studio command bar (must be pre-focused by user) +""" +import ctypes, ctypes.wintypes, subprocess, time, sys, os + +user32 = ctypes.windll.user32 +def key_down(vk): user32.keybd_event(vk, 0, 0, 0) +def key_up(vk): user32.keybd_event(vk, 0, 2, 0) +def press(vk): key_down(vk); time.sleep(0.02); key_up(vk) + +def paste_execute(code): + tmp = os.path.join(os.environ["TEMP"], "rbx.lua") + with open(tmp, "w", encoding="utf-8") as f: + f.write(code) + subprocess.run(["powershell", "-Command", f"Get-Content '{tmp}' -Raw | Set-Clipboard"], capture_output=True, timeout=10) + time.sleep(0.2) + key_down(0x11); key_down(0x41); time.sleep(0.02); key_up(0x41); key_up(0x11) + time.sleep(0.05) + key_down(0x11); key_down(0x56); time.sleep(0.02); key_up(0x56); key_up(0x11) + time.sleep(0.8) + press(0x0D) + time.sleep(2.5) + +hwnd = None +def find_studio(): + global hwnd + target = [None] + def cb(h, _): + l = user32.GetWindowTextLengthW(h) + if l > 0: + buf = ctypes.create_unicode_buffer(l + 1) + user32.GetWindowTextW(h, buf, l + 1) + if "Roblox Studio" in buf.value: + target[0] = h + return False + return True + WNDENUMPROC = ctypes.WINFUNCTYPE(ctypes.c_bool, ctypes.wintypes.HWND, ctypes.wintypes.LPARAM) + user32.EnumWindows(WNDENUMPROC(cb), 0) + return target[0] + +hwnd = find_studio() +if not hwnd: + print("Studio not found!"); sys.exit(1) +user32.ShowWindow(hwnd, 9); time.sleep(0.3) +user32.SetForegroundWindow(hwnd); time.sleep(0.3) + +# ═══════ STEP 1: GTA City - Roads + Sidewalks ═══════ +print("[1/6] GTA roads + sidewalks...") +paste_execute(""" +-- Destroy old map parts, keep scripts +for _,v in pairs(workspace:GetChildren()) do +if v:IsA("Part") or v:IsA("Model") then +if v.Name~="Camera" and v.Name~="Terrain" and v.Name~="SpawnLocation" then +if v.Name:find("Building") or v.Name:find("Cover") or v.Name:find("Tower") or v.Name=="Ground" or v.Name:find("Boundary") then v:Destroy() end +end end end +wait(0.3) +-- New larger ground +local gnd=Instance.new("Part",workspace)gnd.Name="Ground"gnd.Size=Vector3.new(800,2,800)gnd.Position=Vector3.new(0,-1,0)gnd.Anchored=true gnd.BrickColor=BrickColor.new("Dark stone grey")gnd.Material=Enum.Material.Asphalt +-- Main roads (N-S and E-W) +local roadCol=BrickColor.new("Medium stone grey") +for _,r in ipairs({{0,0,800,20},{0,0,20,800}})do +local rd=Instance.new("Part",workspace)rd.Size=Vector3.new(r[3],0.5,r[4])rd.Position=Vector3.new(r[1],0.1,r[2])rd.Anchored=true rd.BrickColor=roadCol rd.Material=Enum.Material.SmoothPlastic rd.Name="Road" +end +-- Cross roads +for _,r in ipairs({{200,0,800,14},{-200,0,800,14},{0,200,14,800},{0,-200,14,800}})do +local rd=Instance.new("Part",workspace)rd.Size=Vector3.new(r[3],0.5,r[4])rd.Position=Vector3.new(r[1],0.1,r[2])rd.Anchored=true rd.BrickColor=roadCol rd.Material=Enum.Material.SmoothPlastic rd.Name="Road" +end +-- Road markings (yellow center lines) +for _,r in ipairs({{0,0,780,0.5},{0,0,0.5,780}})do +local ln=Instance.new("Part",workspace)ln.Size=Vector3.new(r[3],0.3,r[4])ln.Position=Vector3.new(r[1],0.35,r[2])ln.Anchored=true ln.BrickColor=BrickColor.new("Bright yellow")ln.Material=Enum.Material.Neon ln.Name="RoadLine" +end +-- Sidewalks along main roads +for _,s in ipairs({{12,0,800,8},{-12,0,800,8},{-12,0,8,800},{12,0,8,800}})do +local sw=Instance.new("Part",workspace)sw.Size=Vector3.new(s[3],0.8,s[4])sw.Position=Vector3.new(s[1],0.4,s[2])sw.Anchored=true sw.BrickColor=BrickColor.new("Brick yellow")sw.Material=Enum.Material.Pavement sw.Name="Sidewalk" +end +print("ROADS DONE") +""") + +# ═══════ STEP 2: GTA City - Buildings with windows ═══════ +print("[2/6] GTA buildings with windows...") +paste_execute(""" +-- City buildings - various sizes and colors +local bData={ +-- Downtown (center area) +{0,30,0,40,60,30,"Medium stone grey",true}, +{-60,25,-50,30,50,25,"White",true}, +{70,20,50,35,40,28,"Institutional white",true}, +{-80,35,60,45,70,35,"Medium stone grey",true}, +-- Commercial district +{-200,15,-80,30,30,25,"Reddish brown",false}, +{-170,20,-30,28,40,22,"White",true}, +{-230,18,60,32,36,28,"Medium stone grey",true}, +{-180,22,120,26,44,20,"Brick yellow",false}, +-- Residential +{200,12,-120,24,24,20,"Brick yellow",false}, +{240,14,-60,22,28,18,"Brown",false}, +{180,10,100,26,20,22,"Reddish brown",false}, +{220,16,160,20,32,16,"White",false}, +-- Industrial +{-300,18,-200,50,36,40,"Dark stone grey",false}, +{-260,14,-150,40,28,35,"Medium stone grey",false}, +{300,16,200,45,32,38,"Dark stone grey",false}, +{280,12,260,38,24,30,"Dark stone grey",false}, +-- Outskirts +{-350,10,-300,30,20,25,"Brown",false}, +{350,8,300,28,16,22,"Brick yellow",false}, +{-150,10,250,25,20,20,"Reddish brown",false}, +{160,12,-250,22,24,18,"White",false}, +} +for i,b in ipairs(bData)do +local m=Instance.new("Model",workspace)m.Name="CityBuilding"..i +-- Main structure +local p=Instance.new("Part",m)p.Name="Wall"p.Size=Vector3.new(b[4],b[5],b[6])p.Position=Vector3.new(b[1],b[2],b[3])p.Anchored=true p.BrickColor=BrickColor.new(b[7])p.Material=Enum.Material.Brick +-- Roof +local rf=Instance.new("Part",m)rf.Name="Roof"rf.Size=Vector3.new(b[4]+2,1,b[6]+2)rf.Position=Vector3.new(b[1],b[2]*2+0.5,b[3])rf.Anchored=true rf.BrickColor=BrickColor.new("Dark stone grey")rf.Material=Enum.Material.Metal +-- Windows (only for taller buildings) +if b[8]then +for floor=1,math.floor(b[5]/12)do +for wx=1,3 do +local win=Instance.new("Part",m)win.Name="Window_F"..floor.."_W"..wx +win.Size=Vector3.new(3,4,0.3)win.Position=Vector3.new(b[1]-b[4]/2+wx*b[4]/4,b[2]-b[5]/2+floor*12,b[3]+b[6]/2+0.2) +win.Anchored=true win.BrickColor=BrickColor.new("Pastel light blue")win.Material=Enum.Material.Glass win.Transparency=0.3 +end +end +end +end +print("BUILDINGS DONE") +""") + +# ═══════ STEP 3: GTA City - Street objects ═══════ +print("[3/6] GTA street objects (lights, cars, props)...") +paste_execute(""" +-- Street lights +for i=-350,350,50 do +for _,side in ipairs({1,-1})do +local pole=Instance.new("Part",workspace)pole.Name="StreetLight"pole.Size=Vector3.new(0.5,12,0.5)pole.Position=Vector3.new(i+side*15,6,side*15)pole.Anchored=true pole.BrickColor=BrickColor.new("Dark stone grey")pole.Material=Enum.Material.Metal +local bulb=Instance.new("Part",workspace)bulb.Name="LightBulb"bulb.Size=Vector3.new(2,1,2)bulb.Position=Vector3.new(i+side*15,12.5,side*15)bulb.Anchored=true bulb.BrickColor=BrickColor.new("New Yeller")bulb.Material=Enum.Material.Neon +local pl=Instance.new("PointLight",bulb)pl.Brightness=2 pl.Range=30 pl.Color=Color3.fromRGB(255,240,200) +end +end +-- Parked cars +local carColors={"Bright red","Bright blue","White","Black","Bright green","Bright yellow"} +for i=1,18 do +local cx,cz=math.random(-300,300),math.random(-300,300) +if math.abs(cx)<20 or math.abs(cz)<20 then cx=cx+30 end +local car=Instance.new("Model",workspace)car.Name="Car"..i +local body=Instance.new("Part",car)body.Name="Body"body.Size=Vector3.new(5,2,10)body.Position=Vector3.new(cx,1.5,cz)body.Anchored=true body.BrickColor=BrickColor.new(carColors[math.random(#carColors)])body.Material=Enum.Material.Plastic +local top=Instance.new("Part",car)top.Name="Roof"top.Size=Vector3.new(4,1.5,5)top.Position=Vector3.new(cx,3,cz-1)top.Anchored=true top.BrickColor=BrickColor.new("Glass")top.Material=Enum.Material.Glass top.Transparency=0.5 +for _,wo in ipairs({{-2.5,0.8,-3},{2.5,0.8,-3},{-2.5,0.8,3},{2.5,0.8,3}})do +local wh=Instance.new("Part",car)wh.Name="Wheel"wh.Size=Vector3.new(1,2,2)wh.Position=Vector3.new(cx+wo[1],wo[2],cz+wo[3])wh.Anchored=true wh.BrickColor=BrickColor.new("Really black")wh.Material=Enum.Material.Slate +end +end +-- Traffic lights +for _,pos in ipairs({{20,0,20},{-20,0,-20},{20,0,-20},{-20,0,20}})do +local tl=Instance.new("Model",workspace)tl.Name="TrafficLight" +local pole=Instance.new("Part",tl)pole.Size=Vector3.new(0.5,10,0.5)pole.Position=Vector3.new(pos[1]+3,5,pos[3]+3)pole.Anchored=true pole.BrickColor=BrickColor.new("Dark stone grey")pole.Material=Enum.Material.Metal +local box=Instance.new("Part",tl)box.Size=Vector3.new(1,4,1)box.Position=Vector3.new(pos[1]+3,11,pos[3]+3)box.Anchored=true box.BrickColor=BrickColor.new("Dark stone grey") +local red=Instance.new("Part",tl)red.Size=Vector3.new(0.8,0.8,0.3)red.Position=Vector3.new(pos[1]+3,12.2,pos[3]+3.6)red.Anchored=true red.BrickColor=BrickColor.new("Bright red")red.Material=Enum.Material.Neon +local yel=Instance.new("Part",tl)yel.Size=Vector3.new(0.8,0.8,0.3)yel.Position=Vector3.new(pos[1]+3,11.2,pos[3]+3.6)yel.Anchored=true yel.BrickColor=BrickColor.new("Bright yellow")yel.Material=Enum.Material.Neon +local grn=Instance.new("Part",tl)grn.Size=Vector3.new(0.8,0.8,0.3)grn.Position=Vector3.new(pos[1]+3,10.2,pos[3]+3.6)grn.Anchored=true grn.BrickColor=BrickColor.new("Bright green")grn.Material=Enum.Material.Neon +end +-- Trees in park areas +for i=1,25 do +local tx,tz=math.random(-350,350),math.random(-350,350) +if math.abs(tx)<25 and math.abs(tz)<25 then tx=tx+40 end +local trunk=Instance.new("Part",workspace)trunk.Name="TreeTrunk"trunk.Size=Vector3.new(1,6,1)trunk.Position=Vector3.new(tx,3,tz)trunk.Anchored=true trunk.BrickColor=BrickColor.new("Brown")trunk.Material=Enum.Material.Wood +local leaves=Instance.new("Part",workspace)leaves.Name="TreeLeaves"leaves.Size=Vector3.new(6,5,6)leaves.Position=Vector3.new(tx,8,tz)leaves.Anchored=true leaves.BrickColor=BrickColor.new("Dark green")leaves.Material=Enum.Material.Grass leaves.Shape=Enum.PartType.Ball +end +-- Dumpsters, benches, phone booths +for i=1,12 do +local px,pz=math.random(-300,300),math.random(-300,300) +local prop=Instance.new("Part",workspace)prop.Name="Dumpster"..i +prop.Size=Vector3.new(5,3,3)prop.Position=Vector3.new(px,1.5,pz)prop.Anchored=true prop.BrickColor=BrickColor.new("Dark green")prop.Material=Enum.Material.Metal +end +-- Boundary walls +for _,w in ipairs({{0,10,0,800,20,2,0,400},{0,10,0,800,20,2,0,-400},{0,10,0,2,20,800,400,0},{0,10,0,2,20,800,-400,0}})do +local wall=Instance.new("Part",workspace)wall.Name="CityWall"wall.Size=Vector3.new(w[4],w[5],w[6])wall.Position=Vector3.new(w[7],w[2],w[8])wall.Anchored=true wall.BrickColor=BrickColor.new("Dark stone grey")wall.Material=Enum.Material.Concrete wall.Transparency=0.5 +end +print("CITY PROPS DONE") +""") + +# ═══════ STEP 4: Replace GameServer with human enemies ═══════ +print("[4/6] Upgrading enemies to human models...") +paste_execute(""" +-- Destroy old server script and enemies +for _,v in pairs(game.ServerScriptService:GetChildren())do v:Destroy()end +for _,v in pairs(workspace:GetChildren())do if v.Name=="EnemyBot"then v:Destroy()end end +wait(0.3) +local s=Instance.new("Script",game.ServerScriptService)s.Name="GameServer" +s.Source=[[ +local RS=game.ReplicatedStorage local P=game.Players local D=game.Debris +local E=RS:WaitForChild("Events")local HE=E.HitEvent KE=E.KillEvent DE=E.DamageEvent HME=E.HitMarkerEvent +P.PlayerAdded:Connect(function(pl) +local ls=Instance.new("Folder",pl)ls.Name="leaderstats" +Instance.new("IntValue",ls).Name="Kills" +local k=ls.Kills k.Value=0 +Instance.new("IntValue",ls).Name="Deaths" +pl.CharacterAdded:Connect(function(c)local h=c:WaitForChild("Humanoid")h.MaxHealth=100 h.Health=100 h.WalkSpeed=20 +-- Attach visible weapon to player +task.delay(0.5,function() +if c and c:FindFirstChild("Right Arm")then +local gun=Instance.new("Part",c)gun.Name="GunModel"gun.Size=Vector3.new(0.4,0.4,2.5)gun.CanCollide=false gun.Anchored=false +gun.BrickColor=BrickColor.new("Dark stone grey")gun.Material=Enum.Material.Metal +local weld=Instance.new("Weld",gun)weld.Part0=c["Right Arm"]weld.Part1=gun +weld.C0=CFrame.new(0,-0.5,1.5)*CFrame.Angles(0,math.rad(90),0) +end +end) +h.Died:Connect(function()ls.Deaths.Value=ls.Deaths.Value+1 task.delay(4,function()if pl and pl.Parent then pl:LoadCharacter()end end)end) +end)end) +HE.OnServerEvent:Connect(function(pl,hp,dmg,hs) +if hp and hp.Parent and hp.Parent:FindFirstChild("Humanoid")then local hm=hp.Parent.Humanoid +if hm and hm.Health>0 then local d=hs and dmg*2.5 or dmg hm:TakeDamage(d)HME:FireClient(pl,hs) +if hm.Health<=0 then KE:FireClient(pl,"Enemy")ls=pl.leaderstats ls.Kills.Value=ls.Kills.Value+1 end end end end) +-- Human-like enemy models +local skinTones={"Medium stone grey","Light stone grey","Pastel brown","Brick yellow","White","Brown"} +local shirtColors={"Bright red","Bright blue","White","Black","Bright green","Bright yellow","Dark green","Navy blue","Dark orange"} +local pantColors={"Dark stone grey","Black","Medium stone grey","Dark blue","Brown","Navy blue"} +local hairColors={"Black","Dark stone grey","Brown","Dark orange"} +local SP={Vector3.new(-300,3,-300),Vector3.new(300,3,-300),Vector3.new(-300,3,300),Vector3.new(300,3,300),Vector3.new(0,3,-350),Vector3.new(0,3,350),Vector3.new(-350,3,0),Vector3.new(350,3,0),Vector3.new(-200,3,-200),Vector3.new(200,3,200),Vector3.new(-100,3,100),Vector3.new(100,3,-100),Vector3.new(-250,3,150),Vector3.new(250,3,-150),Vector3.new(0,3,0)} +local function mkHuman(sp) +local skin=skinTones[math.random(#skinTones)] +local shirt=shirtColors[math.random(#shirtColors)] +local pants=pantColors[math.random(#pantsColors)] +local hair=hairColors[math.random(#hairColors)] +local m=Instance.new("Model",workspace)m.Name="EnemyBot" +-- Head +local hd=Instance.new("Part",m)hd.Name="Head"hd.Size=Vector3.new(2,2,1)hd.Position=sp+Vector3.new(0,8.5,0)hd.Anchored=false hd.BrickColor=BrickColor.new(skin)hd.Material=Enum.Material.Plastic +-- Face (eyes) +local eye1=Instance.new("Part",m)eye1.Name="Eye1"eye1.Size=Vector3.new(0.3,0.3,0.1)eye1.Position=sp+Vector3.new(-0.35,8.7,0.55)eye1.Anchored=false eye1.BrickColor=BrickColor.new("Really black")eye1.Material=Enum.Material.Plastic +local eye2=Instance.new("Part",m)eye2.Name="Eye2"eye2.Size=Vector3.new(0.3,0.3,0.1)eye2.Position=sp+Vector3.new(0.35,8.7,0.55)eye2.Anchored=false eye2.BrickColor=BrickColor.new("Really black") +-- Hair +local hr=Instance.new("Part",m)hr.Name="Hair"hr.Size=Vector3.new(2.1,0.8,1.1)hr.Position=sp+Vector3.new(0,9.7,0)hr.Anchored=false hr.BrickColor=BrickColor.new(hair)hr.Material=Enum.Material.Plastic +-- Torso +local ts=Instance.new("Part",m)ts.Name="Torso"ts.Size=Vector3.new(2,2,1)ts.Position=sp+Vector3.new(0,6.5,0)ts.Anchored=false ts.BrickColor=BrickColor.new(shirt)ts.Material=Enum.Material.Plastic +-- Arms +local la=Instance.new("Part",m)la.Name="Left Arm"la.Size=Vector3.new(1,2,1)la.Position=sp+Vector3.new(-1.5,6.5,0)la.Anchored=false la.BrickColor=BrickColor.new(skin) +local ra=Instance.new("Part",m)ra.Name="Right Arm"ra.Size=Vector3.new(1,2,1)ra.Position=sp+Vector3.new(1.5,6.5,0)ra.Anchored=false ra.BrickColor=BrickColor.new(skin) +-- Legs +local ll=Instance.new("Part",m)ll.Name="Left Leg"ll.Size=Vector3.new(1,2,1)ll.Position=sp+Vector3.new(-0.5,3.5,0)ll.Anchored=false ll.BrickColor=BrickColor.new(pants) +local rl=Instance.new("Part",m)rl.Name="Right Leg"rl.Size=Vector3.new(1,2,1)rl.Position=sp+Vector3.new(0.5,3.5,0)rl.Anchored=false rl.BrickColor=BrickColor.new(pants) +-- Enemy weapon +local gun=Instance.new("Part",m)gun.Name="GunModel"gun.Size=Vector3.new(0.3,0.3,2)gun.Position=sp+Vector3.new(2,6.5,1)gun.Anchored=false gun.CanCollide=false gun.BrickColor=BrickColor.new("Dark stone grey")gun.Material=Enum.Material.Metal +local hm=Instance.new("Humanoid",m)hm.MaxHealth=100 hm.Health=100 hm.WalkSpeed=14 +local rp=Instance.new("Part",m)rp.Name="HumanoidRootPart"rp.Size=Vector3.new(2,2,1)rp.Position=sp rp.Transparency=1 rp.CanCollide=false +-- Weld all parts +local function wld(p0,p1,c0)local w=Instance.new("Weld")w.Part0=p0 w.Part1=p1 w.C0=c0 or CFrame.new()w.Parent=p0 end +wld(rp,ts,CFrame.new(0,0,0))wld(ts,hd,CFrame.new(0,1.5,0))wld(ts,la,CFrame.new(-1.5,0.5,0))wld(ts,ra,CFrame.new(1.5,0.5,0))wld(ts,ll,CFrame.new(-0.5,-2,0))wld(ts,rl,CFrame.new(0.5,-2,0)) +wld(ra,gun,CFrame.new(0,-0.3,1.5)) +wld(hd,eye1,CFrame.new(-0.35,0.2,0.55))wld(hd,eye2,CFrame.new(0.35,0.2,0.55))wld(hd,hr,CFrame.new(0,1.2,0)) +local tp=SP[math.random(#SP)]local ls=0 +hm.Died:Connect(function()task.delay(5,function()if m.Parent then m:Destroy()end end)task.delay(12,function()mkHuman(SP[math.random(#SP)])end)end) +spawn(function()while m.Parent and hm.Health>0 do task.wait(.4)local r=m:FindFirstChild("HumanoidRootPart")if r then hm:MoveTo(tp)if(r.Position-tp).Magnitude<8 then tp=SP[math.random(#SP)]end end end end) +spawn(function()while m.Parent and hm.Health>0 do task.wait(.2)local r=m:FindFirstChild("HumanoidRootPart")if not r then continue end for _,pl in ipairs(P:GetPlayers())do if pl.Character and pl.Character:FindFirstChild("HumanoidRootPart")then local pr=pl.Character.HumanoidRootPart local d=(pr.Position-r.Position).Magnitude if d<80 then hm:MoveTo(pr.Position)if d<55 and tick()-ls>1 then ls=tick()local ph=pl.Character:FindFirstChild("Humanoid")if ph and ph.Health>0 then ph:TakeDamage(5+math.random(10))DE:FireClient(pl,8)end end end end end end end) +end +for i=1,15 do task.delay(i*.3,function()mkHuman(SP[i])end)end +print("[GameServer] 15 human enemies spawned in GTA city!") +]] +print("ENEMIES DONE") +""") + +# ═══════ STEP 5: Replace WeaponCtrl with gun model switching ═══════ +print("[5/6] Weapon controller with visible guns...") +paste_execute(""" +for _,v in pairs(game.StarterPlayer.StarterPlayerScripts:GetChildren())do v:Destroy()end +local ps=Instance.new("LocalScript",game.StarterPlayer.StarterPlayerScripts)ps.Name="PlayerSetup" +ps.Source=[[local P=game.Players local RS=game.RunService local UI=game.UserInputService local pl=P.LocalPlayer cam=workspace.CurrentCamera +pl.CharacterAdded:Connect(function(c)local h=c:WaitForChild("Humanoid")h.MaxHealth=100 h.Health=100 h.WalkSpeed=20 +RS.RenderStepped:Connect(function()if h.Health>0 then cam.CameraType=Enum.CameraType.LockFirstPerson local hd=c:FindFirstChild("Head")if hd then cam.CFrame=hd.CFrame end end end) +local sp,cr=false,false +UI.InputBegan:Connect(function(i,g)if g then return end if i.KeyCode==Enum.KeyCode.LeftShift then sp=true h.WalkSpeed=30 elseif i.KeyCode==Enum.KeyCode.LeftControl then cr=true h.WalkSpeed=10 end end) +UI.InputEnded:Connect(function(i)if i.KeyCode==Enum.KeyCode.LeftShift then sp=false h.WalkSpeed=cr and 10 or 20 elseif i.KeyCode==Enum.KeyCode.LeftControl then cr=false h.WalkSpeed=sp and 30 or 20 end end)end) +]] +local wc=Instance.new("LocalScript",game.StarterPlayer.StarterPlayerScripts)wc.Name="WeaponCtrl" +wc.Source=[[ +local P=game.Players local RS=game.RunService local UI=game.UserInputService local RepS=game.ReplicatedStorage local TS=game.TweenService local D=game.Debris +local pl=P.LocalPlayer cam=workspace.CurrentCamera ms=pl:GetMouse() +local E=RepS:WaitForChild("Events")local HE=E.HitEvent KE=E.KillEvent HME=E.HitMarkerEvent +local WD=require(RepS:WaitForChild("Shared"):WaitForChild("WeaponData")) +local ci=1 ammo={} isR=false isA=false canS=true ro=0 so=0 kills=0 holdM=false +for i,w in ipairs(WD)do ammo[i]=w.m end +local gunSizes={{0.4,0.4,2.5},{0.4,0.4,3},{0.4,0.5,3},{0.35,0.35,2.8},{0.3,0.3,1.8},{0.3,0.3,2},{0.3,0.3,4},{0.3,0.3,4.5},{0.4,0.4,2},{0.5,0.5,3.5}} +local gunColors={"Dark stone grey","Dark stone grey","Medium stone grey","Dark stone grey","Black","Black","Dark stone grey","Medium stone grey","Dark stone grey","Olive"} +local function updateGunModel() +local c=pl.Character if not c then return end +local old=c:FindFirstChild("GunModel")if old then old:Destroy()end +local arm=c:FindFirstChild("Right Arm")if not arm then return end +local gs=gunSizes[ci]or{0.4,0.4,2.5} +local gun=Instance.new("Part",c)gun.Name="GunModel"gun.Size=Vector3.new(gs[1],gs[2],gs[3])gun.CanCollide=false gun.Anchored=false +gun.BrickColor=BrickColor.new(gunColors[ci]or"Dark stone grey")gun.Material=Enum.Material.Metal +gun.CFrame=arm.CFrame*CFrame.new(0,-0.5,gs[3]/2+0.5) +local weld=Instance.new("Weld",gun)weld.Part0=arm weld.Part1=gun weld.C0=CFrame.new(0,-0.5,gs[3]/2+0.5)*CFrame.Angles(0,math.rad(90),0) +end +local function hud()return pl.PlayerGui:FindFirstChild("COD_HUD")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 h=hud()if h then h.Ammo_Frame.AmmoTxt.Text=ammo[ci].." | "..w.m h.Ammo_Frame.WepName.Text=w.n end updateGunModel()end +UI.InputBegan:Connect(function(i,g)if g then return end +if i.KeyCode.Value>=48 and i.KeyCode.Value<=57 then local idx=i.KeyCode.Value-47 if idx>0 and idx<=10 then sw(idx==10 and 10 or idx)end end +if i.UserInputType==Enum.UserInputType.MouseButton2 then local w=WD[ci]if w.zm then isA=true cam.FieldOfView=70/w.zm else isA=true TS:Create(cam,TweenInfo.new(.15),{FieldOfView=50}):Play()end end +if i.KeyCode==Enum.KeyCode.R and not isR then local w=WD[ci]if ammo[ci]1 then d=dir+Vector3.new((math.random()-.5)*w.s*2,(math.random()-.5)*w.s*2,(math.random()-.5)*w.s*2).Unit end +local r=workspace:Raycast(hd.Position,d*w.rng,rp) +if r then local hp=r.Instance local hs=hp.Name=="Head" +local tr=Instance.new("Part",workspace)tr.Size=Vector3.new(.1,.1,(r.Position-hd.Position).Magnitude)tr.CFrame=CFrame.lookAt(hd.Position,r.Position)*CFrame.new(0,0,-tr.Size.Z/2)tr.Anchored=true tr.CanCollide=false tr.BrickColor=BrickColor.new("New Yeller")tr.Material=Enum.Material.Neon tr.Transparency=.4 D:AddItem(tr,.12) +if w.expl then local ex=Instance.new("Explosion",workspace)ex.Position=r.Position ex.BlastRadius=w.bl or 25 ex.BlastPressure=500000 end +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.d*w.h or w.d HE:FireServer(hp,dm,hs) +if hm.Health<=0 then kills=kills+1 local h=hud()if h then h.ScoreFrame.ScoreTxt.Text="KILLS: "..kills end KE:FireServer("Enemy")end end end end end +ro=math.min(ro+w.rc,w.rc*5)so=math.min(so+w.s*.5,w.s*3) +if ammo[ci]<=0 then task.delay(.2,function()if ammo[ci]<=0 and not isR then isR=true canS=false local ww=WD[ci]local h=hud()if h then h.ReloadBar.Visible=true local f=h.ReloadBar.Fill f.Size=UDim2.new(0,0,1,0)TS:Create(f,TweenInfo.new(ww.r),{Size=UDim2.new(1,0,1,0)}):Play()end task.delay(ww.r,function()ammo[ci]=ww.m isR=false canS=true local h=hud()if h then h.ReloadBar.Visible=false h.Ammo_Frame.AmmoTxt.Text=ammo[ci].." | "..ww.m 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 spawn(function()while holdM and canS do shoot()task.wait(w.f)end 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-.12,0)so=math.max(so-.008,0)end) +pl.CharacterAdded:Connect(function()task.delay(1,updateGunModel)end) +sw(1)print("[WeaponCtrl] 10 COD weapons + visible guns loaded!") +]] +print("WEAPONS DONE") +""") + +# ═══════ STEP 6: Press F5 ═══════ +print("[6/6] Starting Play mode...") +time.sleep(1) +press(0x74) + +print("\n" + "=" * 55) +print(" GTA CITY + COD WEAPONS + HUMAN ENEMIES") +print("=" * 55) +print(" City: 20 buildings, roads, cars, lights, trees") +print(" 15 human enemies with varied skin/clothes") +print(" 10 weapons with visible gun models") +print(" WASD=Move LMB=Shoot RMB=ADS R=Reload") +print(" Shift=Sprint Ctrl=Crouch") +print(" 1=M4A1 2=AK-47 3=SCAR-H 4=ACR 5=MP7") +print(" 6=MP5 7=AWP 8=Intervention 9=SPAS 0=RPG") +print("=" * 55) diff --git a/roblox-fps-complete.lua b/roblox-fps-complete.lua new file mode 100644 index 0000000..5605d4d --- /dev/null +++ b/roblox-fps-complete.lua @@ -0,0 +1,1314 @@ +-- ═══════════════════════════════════════════════════════════════ +-- MINI CALL OF DUTY - COMPLETE GAME (Single Injection) +-- 20 Weapons | Enemy AI | Full HUD | Urban Map +-- ═══════════════════════════════════════════════════════════════ + +-- ── CLEAN SLATE ── +for _, v in pairs({"GameServer", "FPS_HUD", "WeaponClient", "WeaponController", "PlayerSetup"}) do + local s = game.ServerScriptService:FindFirstChild(v) + if s then s:Destroy() end + local g = game.StarterGui:FindFirstChild(v) + if g then g:Destroy() end + local p = game.StarterPlayer.StarterPlayerScripts:FindFirstChild(v) + if p then p:Destroy() end +end +local shared = game.ReplicatedStorage:FindFirstChild("Shared") +if shared then shared:Destroy() end +local events = game.ReplicatedStorage:FindFirstChild("Events") +if events then events:Destroy() end + +-- Clean workspace +for _, v in pairs(workspace:GetChildren()) do + if v:IsA("Model") or v:IsA("Part") or v:IsA("Folder") then + if v.Name ~= "Camera" and v.Name ~= "Terrain" then + v:Destroy() + end + end +end + +wait(0.5) + +-- ═══════════════════════════════════════════════════════════════ +-- PART 1: MAP +-- ═══════════════════════════════════════════════════════════════ + +-- Ground +local ground = Instance.new("Part", workspace) +ground.Name = "Ground" +ground.Size = Vector3.new(400, 2, 400) +ground.Position = Vector3.new(0, -1, 0) +ground.Anchored = true +ground.BrickColor = BrickColor.new("Dark stone grey") +ground.Material = Enum.Material.Concrete + +-- Boundary walls +local wallData = { + {n="NorthWall",s={400,20,2},p={0,10,-200}}, + {n="SouthWall",s={400,20,2},p={0,10,200}}, + {n="EastWall",s={2,20,400},p={200,10,0}}, + {n="WestWall",s={2,20,400},p={-200,10,0}}, +} +for _,w in ipairs(wallData) do + local wall = Instance.new("Part", workspace) + wall.Name = w.n + wall.Size = Vector3.new(unpack(w.s)) + wall.Position = Vector3.new(unpack(w.p)) + wall.Anchored = true + wall.BrickColor = BrickColor.new("Dark stone grey") + wall.Material = Enum.Material.Concrete + wall.Transparency = 0.3 +end + +-- Buildings +local buildings = { + {n="Building_Alpha",s={30,20,25},p={-60,10,-80},c="Medium stone grey"}, + {n="Building_Bravo",s={25,18,30},p={70,9,-60},c="Brown"}, + {n="Building_Charlie",s={35,22,20},p={-40,11,70},c="Dark stone grey"}, + {n="Building_Delta",s={20,16,35},p={80,8,80},c="Medium stone grey"}, + {n="Building_Echo",s={28,24,28},p={0,12,-150},c="Brown"}, +} +for _,b in ipairs(buildings) do + local bld = Instance.new("Model", workspace) + bld.Name = b.n + -- Main structure + local main = Instance.new("Part", bld) + main.Name = "Main" + main.Size = Vector3.new(unpack(b.s)) + main.Position = Vector3.new(unpack(b.p)) + main.Anchored = true + main.BrickColor = BrickColor.new(b.c) + main.Material = Enum.Material.Brick +end + +-- Cover objects (sandbags, crates, barrels) +local coverPositions = { + {-20,1,0},{20,1,0},{0,1,-30},{0,1,30}, + {-50,1,20},{50,1,-20},{-30,1,-50},{30,1,50}, + {-80,1,0},{80,1,0},{0,1,-80},{0,1,80}, + {-10,1,-120},{10,1,120},{-100,1,-40},{100,1,40}, + {-60,1,40},{60,1,-40},{-40,1,-120},{40,1,120}, + {110,1,0},{-110,1,0},{0,1,110},{0,1,-110}, +} +for i,cp in ipairs(coverPositions) do + if i % 3 == 0 then + -- Barrel + local barrel = Instance.new("Part", workspace) + barrel.Name = "Barrel_"..i + barrel.Size = Vector3.new(3, 4, 3) + barrel.Position = Vector3.new(cp[1], cp[2]+2, cp[3]) + barrel.Anchored = true + barrel.BrickColor = BrickColor.new("Reddish brown") + barrel.Material = Enum.Material.Metal + barrel.Shape = Enum.PartType.Cylinder + barrel.Orientation = Vector3.new(0, 0, 90) + elseif i % 3 == 1 then + -- Crate + local crate = Instance.new("Part", workspace) + crate.Name = "Crate_"..i + crate.Size = Vector3.new(5, 5, 5) + crate.Position = Vector3.new(cp[1], cp[2]+2.5, cp[3]) + crate.Anchored = true + crate.BrickColor = BrickColor.new("Brown") + crate.Material = Enum.Material.Wood + else + -- Sandbag + local sandbag = Instance.new("Part", workspace) + sandbag.Name = "Sandbag_"..i + sandbag.Size = Vector3.new(8, 3, 3) + sandbag.Position = Vector3.new(cp[1], cp[2]+1.5, cp[3]) + sandbag.Anchored = true + sandbag.BrickColor = BrickColor.new("Brick yellow") + sandbag.Material = Enum.Material.Sand + end +end + +-- Watchtowers +local towers = {{-120,0,-120},{120,0,-120},{-120,0,120},{120,0,120}} +for i,tp in ipairs(towers) do + local tower = Instance.new("Model", workspace) + tower.Name = "Watchtower_"..i + -- Base + local base = Instance.new("Part", tower) + base.Size = Vector3.new(6, 1, 6) + base.Position = Vector3.new(tp[1], 0.5, tp[3]) + base.Anchored = true + base.BrickColor = BrickColor.new("Dark stone grey") + base.Material = Enum.Material.Metal + -- Legs + for _,off in ipairs({{-2,0,-2},{2,0,-2},{-2,0,2},{2,0,2}}) do + local leg = Instance.new("Part", tower) + leg.Size = Vector3.new(1, 15, 1) + leg.Position = Vector3.new(tp[1]+off[1], 7.5, tp[3]+off[2]) + leg.Anchored = true + leg.BrickColor = BrickColor.new("Dark stone grey") + leg.Material = Enum.Material.Metal + end + -- Platform + local plat = Instance.new("Part", tower) + plat.Size = Vector3.new(8, 1, 8) + plat.Position = Vector3.new(tp[1], 15, tp[3]) + plat.Anchored = true + plat.BrickColor = BrickColor.new("Brown") + plat.Material = Enum.Material.Wood +end + +-- Spawn points +for _,sp in ipairs({{0,3,170},{-30,3,170},{30,3,170}}) do + local spPart = Instance.new("SpawnLocation", workspace) + spPart.Size = Vector3.new(6, 1, 6) + spPart.Position = Vector3.new(unpack(sp)) + spPart.Anchored = true + spPart.CanCollide = false + spPart.Transparency = 1 + spPart.Name = "SpawnPoint" +end + +-- Lighting +local lighting = game:GetService("Lighting") +lighting.ClockTime = 17.5 +lighting.Brightness = 0.5 +lighting.FogEnd = 500 +lighting.FogStart = 200 +lighting.Ambient = Color3.fromRGB(100, 100, 120) +lighting.OutdoorAmbient = Color3.fromRGB(80, 80, 100) + +local bloom = Instance.new("BloomEffect", lighting) +bloom.Intensity = 0.3 +bloom.Size = 24 +bloom.Threshold = 1 + +local cc = Instance.new("ColorCorrectionEffect", lighting) +cc.Contrast = 0.1 +cc.Saturation = 0.1 +cc.TintColor = Color3.fromRGB(255, 240, 220) + +wait(0.3) + +-- ═══════════════════════════════════════════════════════════════ +-- PART 2: SHARED DATA (ReplicatedStorage) +-- ═══════════════════════════════════════════════════════════════ + +local shared = Instance.new("Folder", game.ReplicatedStorage) +shared.Name = "Shared" + +-- RemoteEvents +local events = Instance.new("Folder", game.ReplicatedStorage) +events.Name = "Events" + +Instance.new("RemoteEvent", events).Name = "HitEvent" +Instance.new("RemoteEvent", events).Name = "KillEvent" +Instance.new("RemoteEvent", events).Name = "DamageEvent" +Instance.new("RemoteEvent", events).Name = "WeaponSwitchEvent" +Instance.new("RemoteEvent", events).Name = "ReloadEvent" +Instance.new("RemoteEvent", events).Name = "PlayerDiedEvent" +Instance.new("RemoteEvent", events).Name = "EnemyKilledEvent" +Instance.new("RemoteEvent", events).Name = "HitMarkerEvent" + +-- WeaponData ModuleScript with 20 WEAPONS +local wd = Instance.new("ModuleScript", shared) +wd.Name = "WeaponData" + +wd.Source = [[ +local WeaponData = { + -- ASSAULT RIFLES + {Name="M4A1 Carbine", Category="Assault Rifle", Key=Enum.KeyCode.One, Damage=25, HeadMulti=2.5, FireRate=0.1, MagSize=30, ReloadTime=2.2, Spread=0.02, ADS_Spread=0.008, Recoil=0.3, Range=300, Auto=true, AmmoType="5.56x45mm"}, + {Name="AK-47", Category="Assault Rifle", Key=Enum.KeyCode.Two, Damage=28, HeadMulti=2.5, FireRate=0.12, MagSize=30, ReloadTime=2.5, Spread=0.03, ADS_Spread=0.012, Recoil=0.45, Range=280, Auto=true, AmmoType="7.62x39mm"}, + {Name="FN SCAR-H", Category="Assault Rifle", Key=Enum.KeyCode.Three, Damage=33, HeadMulti=2.5, FireRate=0.11, MagSize=20, ReloadTime=2.6, Spread=0.025, ADS_Spread=0.01, Recoil=0.4, Range=320, Auto=true, AmmoType="7.62x51mm"}, + {Name="M16A4", Category="Assault Rifle", Key=Enum.KeyCode.Four, Damage=30, HeadMulti=2.8, FireRate=0.075, MagSize=30, ReloadTime=2.3, Spread=0.015, ADS_Spread=0.005, Recoil=0.35, Range=350, Auto=false, BurstCount=3, AmmoType="5.56x45mm"}, + {Name="FAMAS F1", Category="Assault Rifle", Key=Enum.KeyCode.Five, Damage=24, HeadMulti=2.5, FireRate=0.065, MagSize=25, ReloadTime=2.1, Spread=0.025, ADS_Spread=0.01, Recoil=0.35, Range=270, Auto=true, AmmoType="5.56x45mm"}, + {Name="HK G36C", Category="Assault Rifle", Key=Enum.KeyCode.Six, Damage=26, HeadMulti=2.5, FireRate=0.09, MagSize=30, ReloadTime=2.2, Spread=0.02, ADS_Spread=0.008, Recoil=0.3, Range=300, Auto=true, AmmoType="5.56x45mm"}, + + -- SMGS + {Name="MP5A4", Category="SMG", Key=Enum.KeyCode.Seven, Damage=20, HeadMulti=2, FireRate=0.08, MagSize=30, ReloadTime=1.8, Spread=0.035, ADS_Spread=0.015, Recoil=0.15, Range=150, Auto=true, AmmoType="9x19mm"}, + {Name="FN P90", Category="SMG", Key=Enum.KeyCode.Eight, Damage=21, HeadMulti=2, FireRate=0.065, MagSize=50, ReloadTime=2.5, Spread=0.04, ADS_Spread=0.018, Recoil=0.18, Range=140, Auto=true, AmmoType="5.7x28mm"}, + {Name="HK MP7A2", Category="SMG", Key=Enum.KeyCode.Nine, Damage=19, HeadMulti=2, FireRate=0.07, MagSize=40, ReloadTime=2.0, Spread=0.03, ADS_Spread=0.012, Recoil=0.12, Range=130, Auto=true, AmmoType="4.6x30mm"}, + {Name="UMP-45", Category="SMG", Key=Enum.KeyCode.Zero, Damage=23, HeadMulti=2, FireRate=0.11, MagSize=25, ReloadTime=2.0, Spread=0.04, ADS_Spread=0.018, Recoil=0.22, Range=160, Auto=true, AmmoType=".45 ACP"}, + + -- SNIPERS + {Name="AWP", Category="Sniper", Key=Enum.KeyCode.Q, Damage=95, HeadMulti=3, FireRate=1.4, MagSize=10, ReloadTime=3.5, Spread=0.001, ADS_Spread=0, Recoil=2.0, Range=800, Auto=false, ScopeZoom=8, AmmoType=".338 Lapua"}, + {Name="Barrett M82", Category="Sniper", Key=Enum.KeyCode.E, Damage=150, HeadMulti=3, FireRate=1.8, MagSize=5, ReloadTime=4.0, Spread=0.002, ADS_Spread=0.001, Recoil=3.5, Range=1000, Auto=false, ScopeZoom=10, AmmoType=".50 BMG"}, + {Name="SVD Dragunov", Category="Sniper", Key=Enum.KeyCode.T, Damage=55, HeadMulti=2.8, FireRate=0.5, MagSize=10, ReloadTime=3.0, Spread=0.005, ADS_Spread=0.002, Recoil=1.2, Range=600, Auto=false, ScopeZoom=4, AmmoType="7.62x54mm"}, + + -- SHOTGUNS + {Name="SPAS-12", Category="Shotgun", Key=Enum.KeyCode.Z, Damage=15, HeadMulti=1.5, FireRate=0.9, MagSize=8, ReloadTime=3.5, Spread=0.1, ADS_Spread=0.08, Recoil=1.5, Range=40, Auto=false, Pellets=8, AmmoType="12 Gauge"}, + {Name="Remington 870", Category="Shotgun", Key=Enum.KeyCode.X, Damage=18, HeadMulti=1.5, FireRate=1.0, MagSize=6, ReloadTime=3.0, Spread=0.12, ADS_Spread=0.09, Recoil=1.8, Range=35, Auto=false, Pellets=6, AmmoType="12 Gauge"}, + + -- LMGS + {Name="M249 SAW", Category="LMG", Key=Enum.KeyCode.C, Damage=28, HeadMulti=2, FireRate=0.08, MagSize=100, ReloadTime=5.5, Spread=0.05, ADS_Spread=0.025, Recoil=0.5, Range=350, Auto=true, AmmoType="5.56x45mm"}, + {Name="M134 Minigun", Category="LMG", Key=Enum.KeyCode.V, Damage=18, HeadMulti=1.8, FireRate=0.04, MagSize=200, ReloadTime=8.0, Spread=0.07, ADS_Spread=0.04, Recoil=0.35, Range=250, Auto=true, AmmoType="7.62x51mm"}, + + -- PISTOLS + {Name="Desert Eagle", Category="Pistol", Key=Enum.KeyCode.B, Damage=45, HeadMulti=3, FireRate=0.3, MagSize=7, ReloadTime=1.8, Spread=0.03, ADS_Spread=0.015, Recoil=0.8, Range=100, Auto=false, AmmoType=".50 AE"}, + {Name="Glock 18C", Category="Pistol", Key=Enum.KeyCode.N, Damage=18, HeadMulti=2, FireRate=0.05, MagSize=20, ReloadTime=1.5, Spread=0.04, ADS_Spread=0.02, Recoil=0.15, Range=60, Auto=true, AmmoType="9x19mm"}, + + -- LAUNCHER + {Name="RPG-7", Category="Launcher", Key=Enum.KeyCode.G, Damage=200, HeadMulti=1, FireRate=2.0, MagSize=1, ReloadTime=4.5, Spread=0.01, ADS_Spread=0.005, Recoil=3.0, Range=200, Auto=false, Explosive=true, BlastRadius=20, AmmoType="PG-7VL"}, +} +return WeaponData +]] + +-- ═══════════════════════════════════════════════════════════════ +-- PART 3: GAME SERVER (ServerScriptService) +-- ═══════════════════════════════════════════════════════════════ + +local gs = Instance.new("Script", game.ServerScriptService) +gs.Name = "GameServer" +gs.Source = [[ +local ReplicatedStorage = game:GetService("ReplicatedStorage") +local Players = game:GetService("Players") +local Workspace = game:GetService("Workspace") + +local Events = ReplicatedStorage:WaitForChild("Events") +local HitEvent = Events:WaitForChild("HitEvent") +local KillEvent = Events:WaitForChild("KillEvent") +local DamageEvent = Events:WaitForChild("DamageEvent") +local PlayerDiedEvent = Events:WaitForChild("PlayerDiedEvent") +local EnemyKilledEvent = Events:WaitForChild("EnemyKilledEvent") +local HitMarkerEvent = Events:WaitForChild("HitMarkerEvent") + +-- Player management +Players.PlayerAdded:Connect(function(player) + player.CharacterAdded:Connect(function(character) + local humanoid = character:WaitForChild("Humanoid") + humanoid.MaxHealth = 100 + humanoid.Health = 100 + humanoid.WalkSpeed = 18 + + -- Spawn loadout + humanoid.Died:Connect(function() + PlayerDiedEvent:FireClient(player, player.Name) + task.delay(4, function() + if player and player.Character and player.Character:FindFirstChild("Humanoid") then + player.Character:FindFirstChild("Humanoid").Health = 0 + end + player:LoadCharacter() + end) + end) + end) +end) + +-- Hit detection from clients +HitEvent.OnServerEvent:Connect(function(player, hitPart, damage, isHeadshot, weaponName) + if hitPart and hitPart.Parent and hitPart.Parent:FindFirstChild("Humanoid") then + local target = hitPart.Parent + local hum = target:FindFirstChild("Humanoid") + if hum and hum.Health > 0 then + local dmg = isHeadshot and damage * 2.5 or damage + hum:TakeDamage(dmg) + HitMarkerEvent:FireClient(player, isHeadshot) + + -- Notify target they took damage + local targetPlayer = Players:GetPlayerFromCharacter(target) + if targetPlayer and targetPlayer ~= player then + DamageEvent:FireClient(targetPlayer, dmg) + end + + if hum.Health <= 0 then + KillEvent:FireClient(player, "Enemy") + player.leaderstats.Kills.Value = player.leaderstats.Kills.Value + 1 + end + end + end +end) + +-- Enemy hit detection +EnemyKilledEvent.OnServerEvent:Connect(function(player, enemyName) + if player and player:FindFirstChild("leaderstats") then + player.leaderstats.Kills.Value = player.leaderstats.Kills.Value + 1 + end +end) + +-- Leaderstats +Players.PlayerAdded:Connect(function(player) + local ls = Instance.new("Folder", player) + ls.Name = "leaderstats" + local kills = Instance.new("IntValue", ls) + kills.Name = "Kills" + kills.Value = 0 + local deaths = Instance.new("IntValue", ls) + deaths.Name = "Deaths" + deaths.Value = 0 + + player.CharacterAdded:Connect(function(char) + local hum = char:WaitForChild("Humanoid") + hum.Died:Connect(function() + deaths.Value = deaths.Value + 1 + end) + end) +end) + +-- ═══════ ENEMY AI SYSTEM ═══════ +local MAX_ENEMIES = 10 +local ENEMY_SPawns = { + Vector3.new(-150, 3, -150), Vector3.new(150, 3, -150), + Vector3.new(-150, 3, 150), Vector3.new(150, 3, 150), + Vector3.new(0, 3, -150), Vector3.new(0, 3, 150), + Vector3.new(-150, 3, 0), Vector3.new(150, 3, 0), + Vector3.new(-100, 3, -100), Vector3.new(100, 3, 100), +} + +local enemies = {} +local patrolPoints = { + Vector3.new(-60, 3, -80), Vector3.new(70, 3, -60), + Vector3.new(-40, 3, 70), Vector3.new(80, 3, 80), + Vector3.new(0, 3, -150), Vector3.new(-120, 3, -120), + Vector3.new(120, 3, -120), Vector3.new(-120, 3, 120), + Vector3.new(120, 3, 120), Vector3.new(0, 3, 0), +} + +local function createEnemy(spawnPos) + local enemy = Instance.new("Model", Workspace) + enemy.Name = "EnemySoldier" + + -- Body + local torso = Instance.new("Part", enemy) + torso.Name = "Torso" + torso.Size = Vector3.new(3, 3, 2) + torso.Position = spawnPos + torso.BrickColor = BrickColor.new("Dark green") + torso.Material = Enum.Material.Plastic + + -- Head + local head = Instance.new("Part", enemy) + head.Name = "Head" + head.Size = Vector3.new(2, 2, 2) + head.Position = spawnPos + Vector3.new(0, 2.5, 0) + head.BrickColor = BrickColor.new("Medium stone grey") + head.Material = Enum.Material.Plastic + + -- Legs + local ll = Instance.new("Part", enemy) + ll.Name = "Left Leg" + ll.Size = Vector3.new(1, 3, 1) + ll.Position = spawnPos + Vector3.new(-0.75, -2.5, 0) + ll.BrickColor = BrickColor.new("Dark green") + ll.Parent = enemy + + local rl = Instance.new("Part", enemy) + rl.Name = "Right Leg" + rl.Size = Vector3.new(1, 3, 1) + rl.Position = spawnPos + Vector3.new(0.75, -2.5, 0) + rl.BrickColor = BrickColor.new("Dark green") + rl.Parent = enemy + + -- Weld everything + local hum = Instance.new("Humanoid", enemy) + hum.MaxHealth = 100 + hum.Health = 100 + hum.WalkSpeed = 12 + + local rootPart = Instance.new("Part", enemy) + rootPart.Name = "HumanoidRootPart" + rootPart.Size = Vector3.new(2, 2, 1) + rootPart.Position = spawnPos + rootPart.Transparency = 1 + rootPart.CanCollide = false + + local function weld(part0, part1) + local w = Instance.new("Weld", part0) + w.Part0 = part0 + w.Part1 = part1 + end + weld(rootPart, torso) + weld(torso, head) + weld(torso, ll) + weld(torso, rl) + + -- AI state + local state = { + model = enemy, + hum = hum, + status = "patrol", + targetPoint = patrolPoints[math.random(#patrolPoints)], + lastShot = 0, + detectRange = 60, + attackRange = 45, + } + + -- Patrol behavior + local function patrolLoop() + while enemy.Parent and hum.Health > 0 do + task.wait(0.5) + if state.status == "patrol" then + local root = enemy:FindFirstChild("HumanoidRootPart") + if root then + hum:MoveTo(state.targetPoint) + if (root.Position - state.targetPoint).Magnitude < 5 then + state.targetPoint = patrolPoints[math.random(#patrolPoints)] + end + end + end + end + end + + -- Detection loop + local function detectLoop() + while enemy.Parent and hum.Health > 0 do + task.wait(0.3) + local root = enemy:FindFirstChild("HumanoidRootPart") + if not root then continue end + for _, player in ipairs(Players:GetPlayers()) do + if player.Character and player.Character:FindFirstChild("HumanoidRootPart") then + local pRoot = player.Character.HumanoidRootPart + local dist = (pRoot.Position - root.Position).Magnitude + if dist < state.detectRange then + state.status = "chase" + hum:MoveTo(pRoot.Position) + if dist < state.attackRange and tick() - state.lastShot > 1.5 then + state.lastShot = tick() + -- Damage player + local pHum = player.Character:FindFirstChild("Humanoid") + if pHum and pHum.Health > 0 then + pHum:TakeDamage(8 + math.random(7)) + DamageEvent:FireClient(player, 10) + end + end + elseif dist > state.detectRange * 1.5 then + state.status = "patrol" + end + end + end + end + end + + -- Death handler + hum.Died:Connect(function() + for _, p in ipairs(Players:GetPlayers()) do + local char = p.Character + if char and char:FindFirstChild("HumanoidRootPart") then + local dist = (enemy:FindFirstChild("HumanoidRootPart") and enemy.HumanoidRootPart.Position or Vector3.zero) - char.HumanoidRootPart.Position + if dist.Magnitude < 80 then + EnemyKilledEvent:FireClient(p, enemy.Name) + end + end + end + task.delay(8, function() + if enemy and enemy.Parent then enemy:Destroy() end + end) + -- Respawn new enemy + task.delay(12, function() + if #Workspace:GetChildren() - 10 < MAX_ENEMIES then + local sp = ENEMY_SPawns[math.random(#ENEMY_SPawns)] + createEnemy(sp) + end + end) + end) + + coroutine.wrap(patrolLoop)() + coroutine.wrap(detectLoop)() + return state +end + +-- Spawn initial enemies +for i = 1, MAX_ENEMIES do + task.delay(i * 0.5, function() + createEnemy(ENEMY_SPawns[i]) + end) +end + +print("[GameServer] 20-Weapon FPS Game loaded!") +]] + +-- ═══════════════════════════════════════════════════════════════ +-- PART 4: HUD (StarterGui) +-- ═══════════════════════════════════════════════════════════════ + +local hud = Instance.new("ScreenGui", game.StarterGui) +hud.Name = "FPS_HUD" +hud.ResetOnSpawn = false +hud.ZIndexBehavior = Enum.ZIndexBehavior.Sibling + +-- Crosshair +local cross = Instance.new("Frame", hud) +cross.Name = "Crosshair" +cross.Size = UDim2.new(0, 20, 0, 2) +cross.Position = UDim2.new(0.5, -10, 0.5, -1) +cross.BackgroundColor3 = Color3.new(1, 1, 1) +cross.BorderSizePixel = 0 + +local crossV = Instance.new("Frame", hud) +crossV.Name = "CrosshairV" +crossV.Size = UDim2.new(0, 2, 0, 20) +crossV.Position = UDim2.new(0.5, -1, 0.5, -10) +crossV.BackgroundColor3 = Color3.new(1, 1, 1) +crossV.BorderSizePixel = 0 + +-- Hit Marker +local hm = Instance.new("Frame", hud) +hm.Name = "HitMarker" +hm.Size = UDim2.new(0, 30, 0, 30) +hm.Position = UDim2.new(0.5, -15, 0.5, -15) +hm.BackgroundTransparency = 1 +hm.Visible = false + +local hm1 = Instance.new("Frame", hm) +hm1.Size = UDim2.new(0, 15, 0, 3) +hm1.Position = UDim2.new(0, 15, 0, 0) +hm1.Rotation = 45 +hm1.BackgroundColor3 = Color3.new(1, 1, 1) +hm1.BorderSizePixel = 0 + +local hm2 = Instance.new("Frame", hm) +hm2.Size = UDim2.new(0, 15, 0, 3) +hm2.Position = UDim2.new(0, 0, 0, 15) +hm2.Rotation = 45 +hm2.BackgroundColor3 = Color3.new(1, 1, 1) +hm2.BorderSizePixel = 0 + +-- Health Bar (bottom left) +local hbFrame = Instance.new("Frame", hud) +hbFrame.Name = "HealthFrame" +hbFrame.Size = UDim2.new(0, 250, 0, 30) +hbFrame.Position = UDim2.new(0, 20, 1, -60) +hbFrame.BackgroundColor3 = Color3.fromRGB(30, 30, 30) +hbFrame.BorderSizePixel = 0 +hbFrame.BackgroundTransparency = 0.3 + +local hbFill = Instance.new("Frame", hbFrame) +hbFill.Name = "HealthFill" +hbFill.Size = UDim2.new(1, 0, 1, 0) +hbFill.BackgroundColor3 = Color3.fromRGB(0, 200, 0) +hbFill.BorderSizePixel = 0 + +local hbText = Instance.new("TextLabel", hbFrame) +hbText.Name = "HealthText" +hbText.Size = UDim2.new(1, 0, 1, 0) +hbText.BackgroundTransparency = 1 +hbText.TextColor3 = Color3.new(1, 1, 1) +hbText.TextStrokeTransparency = 0.5 +hbText.Font = Enum.Font.GothamBold +hbText.TextSize = 16 +hbText.Text = "100 HP" + +-- Ammo display (bottom right) +local ammoFrame = Instance.new("Frame", hud) +ammoFrame.Name = "AmmoFrame" +ammoFrame.Size = UDim2.new(0, 200, 0, 60) +ammoFrame.Position = UDim2.new(1, -220, 1, -80) +ammoFrame.BackgroundTransparency = 1 + +local ammoText = Instance.new("TextLabel", ammoFrame) +ammoText.Name = "AmmoText" +ammoText.Size = UDim2.new(1, 0, 0.6, 0) +ammoText.Position = UDim2.new(0, 0, 0, 0) +ammoText.BackgroundTransparency = 1 +ammoText.TextColor3 = Color3.new(1, 1, 1) +ammoText.TextStrokeTransparency = 0.5 +ammoText.Font = Enum.Font.GothamBold +ammoText.TextSize = 28 +ammoText.TextXAlignment = Enum.TextXAlignment.Right +ammoText.Text = "30 / 30" + +local weaponName = Instance.new("TextLabel", ammoFrame) +weaponName.Name = "WeaponName" +weaponName.Size = UDim2.new(1, 0, 0.4, 0) +weaponName.Position = UDim2.new(0, 0, 0.6, 0) +weaponName.BackgroundTransparency = 1 +weaponName.TextColor3 = Color3.fromRGB(200, 200, 200) +weaponName.TextStrokeTransparency = 0.7 +weaponName.Font = Enum.Font.Gotham +weaponName.TextSize = 14 +weaponName.TextXAlignment = Enum.TextXAlignment.Right +weaponName.Text = "M4A1 Carbine" + +-- Reload bar +local reloadBar = Instance.new("Frame", hud) +reloadBar.Name = "ReloadBar" +reloadBar.Size = UDim2.new(0, 200, 0, 6) +reloadBar.Position = UDim2.new(0.5, -100, 1, -120) +reloadBar.BackgroundColor3 = Color3.fromRGB(60, 60, 60) +reloadBar.BorderSizePixel = 0 +reloadBar.Visible = false +reloadBar.BackgroundTransparency = 0.3 + +local reloadFill = Instance.new("Frame", reloadBar) +reloadFill.Name = "Fill" +reloadFill.Size = UDim2.new(0, 0, 1, 0) +reloadFill.BackgroundColor3 = Color3.fromRGB(255, 200, 0) +reloadFill.BorderSizePixel = 0 + +local reloadText = Instance.new("TextLabel", hud) +reloadText.Name = "ReloadText" +reloadText.Size = UDim2.new(0, 200, 0, 20) +reloadText.Position = UDim2.new(0.5, -100, 1, -140) +reloadText.BackgroundTransparency = 1 +reloadText.TextColor3 = Color3.fromRGB(255, 200, 0) +reloadText.Font = Enum.Font.GothamBold +reloadText.TextSize = 14 +reloadText.Text = "RELOADING..." +reloadText.Visible = false + +-- Kill Feed (top right) +local kf = Instance.new("Frame", hud) +kf.Name = "KillFeed" +kf.Size = UDim2.new(0, 250, 0, 200) +kf.Position = UDim2.new(1, -260, 0, 10) +kf.BackgroundTransparency = 1 + +local kfLayout = Instance.new("UIListLayout", kf) +kfLayout.SortOrder = Enum.SortOrder.LayoutOrder +kfLayout.Padding = UDim.new(0, 4) +kfLayout.VerticalAlignment = Enum.VerticalAlignment.Top + +-- Score display (top center) +local scoreFrame = Instance.new("Frame", hud) +scoreFrame.Name = "ScoreFrame" +scoreFrame.Size = UDim2.new(0, 200, 0, 40) +scoreFrame.Position = UDim2.new(0.5, -100, 0, 10) +scoreFrame.BackgroundColor3 = Color3.fromRGB(20, 20, 20) +scoreFrame.BackgroundTransparency = 0.5 +scoreFrame.BorderSizePixel = 0 + +local scoreText = Instance.new("TextLabel", scoreFrame) +scoreText.Name = "ScoreText" +scoreText.Size = UDim2.new(1, 0, 1, 0) +scoreText.BackgroundTransparency = 1 +scoreText.TextColor3 = Color3.new(1, 1, 1) +scoreText.Font = Enum.Font.GothamBold +scoreText.TextSize = 20 +scoreText.Text = "KILLS: 0" + +-- Streak banner (center) +local streak = Instance.new("TextLabel", hud) +streak.Name = "StreakBanner" +streak.Size = UDim2.new(0, 400, 0, 60) +streak.Position = UDim2.new(0.5, -200, 0.3, 0) +streak.BackgroundTransparency = 1 +streak.TextColor3 = Color3.fromRGB(255, 50, 50) +streak.Font = Enum.Font.GothamBold +streak.TextSize = 36 +streak.TextStrokeTransparency = 0.3 +streak.Text = "" +streak.Visible = false + +-- Damage Vignette +local vignette = Instance.new("ImageLabel", hud) +vignette.Name = "DamageVignette" +vignette.Size = UDim2.new(1, 0, 1, 0) +vignette.Position = UDim2.new(0, 0, 0, 0) +vignette.BackgroundTransparency = 1 +vignette.ImageTransparency = 1 +vignette.Image = "rbxassetid://1489679531" +vignette.ImageColor3 = Color3.new(1, 0, 0) +vignette.ScaleType = Enum.ScaleType.Slice +vignette.SliceCenter = Rect.new(0.4, 0.4, 0.6, 0.6) + +-- Minimap (top left) +local minimap = Instance.new("Frame", hud) +minimap.Name = "Minimap" +minimap.Size = UDim2.new(0, 150, 0, 150) +minimap.Position = UDim2.new(0, 10, 0, 10) +minimap.BackgroundColor3 = Color3.fromRGB(20, 20, 30) +minimap.BorderSizePixel = 2 +minimap.BorderColor3 = Color3.fromRGB(100, 100, 100) + +local mapIcon = Instance.new("Frame", minimap) +mapIcon.Name = "PlayerDot" +mapIcon.Size = UDim2.new(0, 6, 0, 6) +mapIcon.Position = UDim2.new(0.5, -3, 0.5, -3) +mapIcon.BackgroundColor3 = Color3.fromRGB(0, 150, 255) +mapIcon.BorderSizePixel = 0 +mapIcon.Shape = Enum.UIRectShape.Circle + +-- Weapon list (bottom center) +local weaponList = Instance.new("Frame", hud) +weaponList.Name = "WeaponList" +weaponList.Size = UDim2.new(0, 500, 0, 25) +weaponList.Position = UDim2.new(0.5, -250, 1, -25) +weaponList.BackgroundColor3 = Color3.fromRGB(15, 15, 15) +weaponList.BackgroundTransparency = 0.5 +weaponList.BorderSizePixel = 0 + +-- ═══════════════════════════════════════════════════════════════ +-- PART 5: PLAYER SETUP (StarterPlayerScripts) +-- ═══════════════════════════════════════════════════════════════ + +local ps = Instance.new("LocalScript", game.StarterPlayer.StarterPlayerScripts) +ps.Name = "PlayerSetup" +ps.Source = [[ +local Players = game:GetService("Players") +local RunService = game:GetService("RunService") +local UserInputService = game:GetService("UserInputService") +local ReplicatedStorage = game:GetService("ReplicatedStorage") +local TweenService = game:GetService("TweenService") + +local player = Players.LocalPlayer +local camera = workspace.CurrentCamera + +player.CharacterAdded:Connect(function(character) + local humanoid = character:WaitForChild("Humanoid") + local rootPart = character:WaitForChild("HumanoidRootPart") + + -- First person camera + RunService.RenderStepped:Connect(function() + if humanoid.Health > 0 then + camera.CameraType = Enum.CameraType.LockFirstPerson + local head = character:FindFirstChild("Head") + if head then + camera.CFrame = head.CFrame + end + end + end) + + -- Sprint / Crouch + local sprinting = false + local crouching = false + + UserInputService.InputBegan:Connect(function(input, gpe) + if gpe then return end + if input.KeyCode == Enum.KeyCode.LeftShift then + sprinting = true + humanoid.WalkSpeed = 28 + elseif input.KeyCode == Enum.KeyCode.LeftControl then + crouching = true + humanoid.WalkSpeed = 8 + end + end) + + UserInputService.InputEnded:Connect(function(input) + if input.KeyCode == Enum.KeyCode.LeftShift then + sprinting = false + humanoid.WalkSpeed = crouching and 8 or 18 + elseif input.KeyCode == Enum.KeyCode.LeftControl then + crouching = false + humanoid.WalkSpeed = sprinting and 28 or 18 + end + end) +end) + +-- Kill Feed listener +local Events = ReplicatedStorage:WaitForChild("Events") +local KillEvent = Events:WaitForChild("KillEvent") +local DamageEvent = Events:WaitForChild("DamageEvent") +local HitMarkerEvent = Events:WaitForChild("HitMarkerEvent") + +KillEvent.OnClientEvent:Connect(function(killer) + local hud = player:WaitForChild("PlayerGui"):WaitForChild("FPS_HUD") + local kf = hud:FindFirstChild("KillFeed") + + local entry = Instance.new("TextLabel", kf) + entry.Size = UDim2.new(1, 0, 0, 20) + entry.BackgroundColor3 = Color3.fromRGB(0, 0, 0) + entry.BackgroundTransparency = 0.5 + entry.TextColor3 = Color3.new(1, 1, 1) + entry.Font = Enum.Font.GothamBold + entry.TextSize = 13 + entry.Text = player.Name .. " eliminated " .. (killer or "Enemy") + entry.TextXAlignment = Enum.TextXAlignment.Right + + game:GetService("Debris"):AddItem(entry, 5) +end) + +-- Damage vignette +DamageEvent.OnClientEvent:Connect(function(dmg) + local hud = player:WaitForChild("PlayerGui"):WaitForChild("FPS_HUD") + local vig = hud:FindFirstChild("DamageVignette") + if vig then + vig.ImageTransparency = 0.3 + local t = TweenService:Create(vig, TweenInfo.new(0.8), {ImageTransparency = 1}) + t:Play() + end +end) + +-- Hit marker flash +HitMarkerEvent.OnClientEvent:Connect(function(isHeadshot) + local hud = player:WaitForChild("PlayerGui"):WaitForChild("FPS_HUD") + local hm = hud:FindFirstChild("HitMarker") + if hm then + hm.Visible = true + if isHeadshot then + for _, c in pairs(hm:GetChildren()) do + c.BackgroundColor3 = Color3.fromRGB(255, 50, 50) + end + else + for _, c in pairs(hm:GetChildren()) do + c.BackgroundColor3 = Color3.new(1, 1, 1) + end + end + task.delay(0.15, function() + hm.Visible = false + end) + end +end) + +-- Minimap updater +RunService.RenderStepped:Connect(function() + local hud = player.PlayerGui:FindFirstChild("FPS_HUD") + if not hud then return end + local minimap = hud:FindFirstChild("Minimap") + if not minimap then return end + + local character = player.Character + if not character or not character:FindFirstChild("HumanoidRootPart") then return end + + local pos = character.HumanoidRootPart.Position + local mapSize = 400 + local mmSize = 150 + + -- Clear old enemy dots + for _, c in pairs(minimap:GetChildren()) do + if c.Name == "EnemyDot" then c:Destroy() end + end + + -- Player dot + local dot = minimap:FindFirstChild("PlayerDot") + if dot then + local rx = (pos.X / mapSize + 0.5) * mmSize + local rz = (pos.Z / mapSize + 0.5) * mmSize + dot.Position = UDim2.new(0, rx - 3, 0, rz - 3) + end + + -- Enemy dots + for _, obj in pairs(workspace:GetChildren()) do + if obj:IsA("Model") and obj.Name == "EnemySoldier" and obj:FindFirstChild("HumanoidRootPart") then + local epos = obj.HumanoidRootPart.Position + local dist = (epos - pos).Magnitude + if dist < 100 then + local ex = (epos.X / mapSize + 0.5) * mmSize + local ez = (epos.Z / mapSize + 0.5) * mmSize + local eDot = Instance.new("Frame", minimap) + eDot.Name = "EnemyDot" + eDot.Size = UDim2.new(0, 4, 0, 4) + eDot.Position = UDim2.new(0, ex - 2, 0, ez - 2) + eDot.BackgroundColor3 = Color3.new(1, 0, 0) + eDot.BorderSizePixel = 0 + eDot.Shape = Enum.UIRectShape.Circle + end + end + end + + -- Health bar update + local char = player.Character + if char and char:FindFirstChild("Humanoid") then + local h = char.Humanoid + local hFrame = hud:FindFirstChild("HealthFrame") + if hFrame then + local fill = hFrame:FindFirstChild("HealthFill") + local txt = hFrame:FindFirstChild("HealthText") + if fill then + fill.Size = UDim2.new(h.Health / h.MaxHealth, 0, 1, 0) + if h.Health > 60 then fill.BackgroundColor3 = Color3.fromRGB(0, 200, 0) + elseif h.Health > 30 then fill.BackgroundColor3 = Color3.fromRGB(255, 200, 0) + else fill.BackgroundColor3 = Color3.fromRGB(255, 0, 0) end + end + if txt then txt.Text = math.floor(h.Health) .. " HP" end + end + end +end) + +print("[PlayerSetup] Loaded!") +]] + +-- ═══════════════════════════════════════════════════════════════ +-- PART 6: WEAPON CONTROLLER (StarterPlayerScripts) - 20 WEAPONS +-- ═══════════════════════════════════════════════════════════════ + +local wc = Instance.new("LocalScript", game.StarterPlayer.StarterPlayerScripts) +wc.Name = "WeaponController" +wc.Source = [[ +local Players = game:GetService("Players") +local RunService = game:GetService("RunService") +local UserInputService = game:GetService("UserInputService") +local ReplicatedStorage = game:GetService("ReplicatedStorage") +local TweenService = game:GetService("TweenService") +local Debris = game:GetService("Debris") + +local player = Players.LocalPlayer +local camera = workspace.CurrentCamera +local mouse = player:GetMouse() + +local Events = ReplicatedStorage:WaitForChild("Events") +local HitEvent = Events:WaitForChild("HitEvent") +local KillEvent = Events:WaitForChild("KillEvent") +local WeaponSwitchEvent = Events:WaitForChild("WeaponSwitchEvent") + +local WeaponData = require(ReplicatedStorage:WaitForChild("Shared"):WaitForChild("WeaponData")) + +-- State +local currentIndex = 1 +local currentAmmo = {} +local isReloading = false +local isADS = false +local canShoot = true +local recoilOffset = 0 +local spreadOffset = 0 +local lastShotTime = 0 +local kills = 0 +local killStreak = 0 +local lastKillTime = 0 + +-- Initialize ammo for all weapons +for i, w in ipairs(WeaponData) do + currentAmmo[i] = w.MagSize +end + +-- Key map +local keyMap = {} +for i, w in ipairs(WeaponData) do + keyMap[w.Key] = i +end + +-- ═══════ WEAPON SWITCHING ═══════ +local function switchWeapon(index) + if index < 1 or index > #WeaponData or isReloading then return end + currentIndex = index + local w = WeaponData[currentIndex] + + -- Update HUD + local hud = player.PlayerGui:FindFirstChild("FPS_HUD") + if hud then + local ammoText = hud:FindFirstChild("AmmoFrame"):FindFirstChild("AmmoText") + local wnText = hud:FindFirstChild("AmmoFrame"):FindFirstChild("WeaponName") + if ammoText then ammoText.Text = currentAmmo[currentIndex] .. " / " .. w.MagSize end + if wnText then wnText.Text = w.Name end + end + + isADS = false + camera.FieldOfView = 70 + recoilOffset = 0 + spreadOffset = 0 +end + +UserInputService.InputBegan:Connect(function(input, gpe) + if gpe then return end + + -- Weapon keys + if keyMap[input.KeyCode] then + switchWeapon(keyMap[input.KeyCode]) + end + + -- ADS (Right mouse button) + if input.UserInputType == Enum.UserInputType.MouseButton2 then + local w = WeaponData[currentIndex] + if w.ScopeZoom then + isADS = true + camera.FieldOfView = 70 / w.ScopeZoom + elseif isADS == false then + isADS = true + local t = TweenService:Create(camera, TweenInfo.new(0.15), {FieldOfView = 45}) + t:Play() + end + end + + -- Reload + if input.KeyCode == Enum.KeyCode.R and not isReloading then + local w = WeaponData[currentIndex] + if currentAmmo[currentIndex] < w.MagSize then + isReloading = true + canShoot = false + + local hud = player.PlayerGui:FindFirstChild("FPS_HUD") + if hud then + hud.ReloadBar.Visible = true + hud.ReloadText.Visible = true + end + + -- Animate reload bar + local bar = hud and hud:FindFirstChild("ReloadBar") + local fill = bar and bar:FindFirstChild("Fill") + if fill then + fill.Size = UDim2.new(0, 0, 1, 0) + local rt = TweenService:Create(fill, TweenInfo.new(w.ReloadTime), {Size = UDim2.new(1, 0, 1, 0)}) + rt:Play() + end + + task.delay(w.ReloadTime, function() + currentAmmo[currentIndex] = w.MagSize + isReloading = false + canShoot = true + if hud then + hud.ReloadBar.Visible = false + hud.ReloadText.Visible = false + local ammoText = hud:FindFirstChild("AmmoFrame"):FindFirstChild("AmmoText") + if ammoText then ammoText.Text = currentAmmo[currentIndex] .. " / " .. w.MagSize end + end + end) + end + end +end) + +UserInputService.InputEnded:Connect(function(input) + if input.UserInputType == Enum.UserInputType.MouseButton2 then + isADS = false + local t = TweenService:Create(camera, TweenInfo.new(0.15), {FieldOfView = 70}) + t:Play() + end +end) + +-- ═══════ SHOOTING ═══════ +local function shoot() + local w = WeaponData[currentIndex] + if not canShoot or isReloading then return end + if currentAmmo[currentIndex] <= 0 then return end + + currentAmmo[currentIndex] = currentAmmo[currentIndex] - 1 + + -- Update ammo HUD + local hud = player.PlayerGui:FindFirstChild("FPS_HUD") + if hud then + local ammoText = hud:FindFirstChild("AmmoFrame"):FindFirstChild("AmmoText") + if ammoText then ammoText.Text = currentAmmo[currentIndex] .. " / " .. w.MagSize end + end + + -- Raycast + local character = player.Character + if not character or not character:FindFirstChild("Head") then return end + + local head = character.Head + local spread = isADS and w.ADS_Spread or w.Spread + spread = spread + spreadOffset + + local rayOrigin = head.Position + local rayDir = (mouse.Hit.Position - rayOrigin).Unit + -- Add spread + rayDir = rayDir + Vector3.new( + (math.random() - 0.5) * spread, + (math.random() - 0.5) * spread, + (math.random() - 0.5) * spread + ) + rayDir = rayDir.Unit + + local rayParams = RaycastParams.new() + rayParams.FilterType = Enum.RaycastFilterType.Exclude + rayParams.FilterDescendantsInstances = {character} + + -- Shotgun pellets + local pellets = w.Pellets or 1 + for p = 1, pellets do + local pDir = rayDir + if pellets > 1 then + pDir = pDir + Vector3.new( + (math.random() - 0.5) * w.Spread * 2, + (math.random() - 0.5) * w.Spread * 2, + (math.random() - 0.5) * w.Spread * 2 + ) + pDir = pDir.Unit + end + + local result = workspace:Raycast(rayOrigin, pDir * w.Range, rayParams) + if result then + local hitPart = result.Instance + local isHeadshot = hitPart.Name == "Head" + + -- Bullet trail + local trail = Instance.new("Part", workspace) + trail.Size = Vector3.new(0.1, 0.1, (result.Position - rayOrigin).Magnitude) + trail.CFrame = CFrame.lookAt(rayOrigin, result.Position) * CFrame.new(0, 0, -trail.Size.Z / 2) + trail.Anchored = true + trail.CanCollide = false + trail.BrickColor = BrickColor.new("Bright yellow") + trail.Material = Enum.Material.Neon + trail.Transparency = 0.3 + Debris:AddItem(trail, 0.15) + + -- Impact spark + local spark = Instance.new("Part", workspace) + spark.Size = Vector3.new(0.5, 0.5, 0.5) + spark.Position = result.Position + spark.Anchored = true + spark.CanCollide = false + spark.BrickColor = BrickColor.new("Bright orange") + spark.Material = Enum.Material.Neon + Debris:AddItem(spark, 0.1) + + -- Check if enemy + if hitPart.Parent and hitPart.Parent:FindFirstChild("Humanoid") then + local hum = hitPart.Parent:FindFirstChild("Humanoid") + if hum and hum.Health > 0 then + local dmg = isHeadshot and w.Damage * w.HeadMulti or w.Damage + if w.Explosive then + dmg = w.Damage + -- Explosion + local explosion = Instance.new("Explosion", workspace) + explosion.Position = result.Position + explosion.BlastRadius = w.BlastRadius or 20 + explosion.BlastPressure = 500000 + end + + HitEvent:FireServer(hitPart, dmg, isHeadshot, w.Name) + + if hum.Health <= 0 then + kills = kills + 1 + killStreak = killStreak + 1 + lastKillTime = tick() + + -- Update score + if hud then + local st = hud:FindFirstChild("ScoreFrame"):FindFirstChild("ScoreText") + if st then st.Text = "KILLS: " .. kills end + + -- Kill streak banner + local banner = hud:FindFirstChild("StreakBanner") + if banner then + local streaks = { + {2, "DOUBLE KILL!"}, + {3, "TRIPLE KILL!"}, + {5, "KILLING SPREE!"}, + {7, "UNSTOPPABLE!"}, + {10, "GODLIKE!"}, + } + for _, s in ipairs(streaks) do + if killStreak == s[1] then + banner.Text = s[2] + banner.Visible = true + task.delay(2, function() + banner.Visible = false + end) + break + end + end + end + end + + KillEvent:FireServer("EnemySoldier") + end + end + end + end + end + + -- Recoil + recoilOffset = math.min(recoilOffset + w.Recoil, w.Recoil * 5) + spreadOffset = math.min(spreadOffset + w.Spread * 0.5, w.Spread * 3) + + -- Auto reload when empty + if currentAmmo[currentIndex] <= 0 then + task.delay(0.3, function() + if currentAmmo[currentIndex] <= 0 and not isReloading then + -- Trigger reload + isReloading = true + canShoot = false + local ww = WeaponData[currentIndex] + if hud then + hud.ReloadBar.Visible = true + hud.ReloadText.Visible = true + end + local fill = hud and hud:FindFirstChild("ReloadBar") and hud.ReloadBar:FindFirstChild("Fill") + if fill then + fill.Size = UDim2.new(0, 0, 1, 0) + TweenService:Create(fill, TweenInfo.new(ww.ReloadTime), {Size = UDim2.new(1, 0, 1, 0)}):Play() + end + task.delay(ww.ReloadTime, function() + currentAmmo[currentIndex] = ww.MagSize + isReloading = false + canShoot = true + if hud then + hud.ReloadBar.Visible = false + hud.ReloadText.Visible = false + local at = hud:FindFirstChild("AmmoFrame"):FindFirstChild("AmmoText") + if at then at.Text = currentAmmo[currentIndex] .. " / " .. ww.MagSize end + end + end) + end + end) + end +end + +-- ═══════ FIRE RATE CONTROL ═══════ +local holdingMouse = false + +UserInputService.InputBegan:Connect(function(input, gpe) + if gpe then return end + if input.UserInputType == Enum.UserInputType.MouseButton1 then + holdingMouse = true + local w = WeaponData[currentIndex] + + if w.Auto then + -- Auto fire loop + task.spawn(function() + while holdingMouse and canShoot do + shoot() + task.wait(w.FireRate) + end + end) + else + -- Semi-auto / burst + if w.BurstCount then + for b = 1, w.BurstCount do + shoot() + task.wait(w.FireRate) + end + else + shoot() + end + end + end +end) + +UserInputService.InputEnded:Connect(function(input) + if input.UserInputType == Enum.UserInputType.MouseButton1 then + holdingMouse = false + end +end) + +-- ═══════ RECOIL / SPREAD DECAY ═══════ +RunService.RenderStepped:Connect(function() + recoilOffset = math.max(recoilOffset - 0.15, 0) + spreadOffset = math.max(spreadOffset - 0.01, 0) + + -- Crosshair spread visual + local hud = player.PlayerGui:FindFirstChild("FPS_HUD") + if hud then + local w = WeaponData[currentIndex] + local baseSpread = isADS and w.ADS_Spread or w.Spread + local totalSpread = baseSpread + spreadOffset + local offset = math.floor(totalSpread * 300) + + local ch = hud:FindFirstChild("Crosshair") + local cv = hud:FindFirstChild("CrosshairV") + if ch then ch.Position = UDim2.new(0.5, -10 - offset, 0.5, -1) end + if cv then cv.Position = UDim2.new(0.5, -1, 0.5, -10 - offset) end + end + + -- Kill streak decay + if tick() - lastKillTime > 5 and killStreak > 0 then + killStreak = 0 + end +end) + +-- Initialize first weapon display +switchWeapon(1) + +print("[WeaponController] 20 weapons loaded!") +]] + +-- ═══════════════════════════════════════════════════════════════ +-- WEAPON LIST HUD (keys display) +-- ═══════════════════════════════════════════════════════════════ + +local weaponListFrame = hud:FindFirstChild("WeaponList") +if weaponListFrame then + local keyLabels = { + {key="1-6", label="ASSAULT RIFLES", color=Color3.fromRGB(100,150,255)}, + {key="7-0", label="SMGS", color=Color3.fromRGB(100,255,100)}, + {key="Q/E/T", label="SNIPERS", color=Color3.fromRGB(255,100,100)}, + {key="Z/X", label="SHOTGUNS", color=Color3.fromRGB(255,200,50)}, + {key="C/V", label="LMGS", color=Color3.fromRGB(200,100,255)}, + {key="B/N/G", label="PISTOL/LAUNCHER", color=Color3.fromRGB(255,150,100)}, + } + for i, kl in ipairs(keyLabels) do + local lbl = Instance.new("TextLabel", weaponListFrame) + lbl.Size = UDim2.new(1/#keyLabels, 0, 1, 0) + lbl.Position = UDim2.new((i-1)/#keyLabels, 0, 0, 0) + lbl.BackgroundColor3 = kl.color + lbl.BackgroundTransparency = 0.7 + lbl.TextColor3 = Color3.new(1, 1, 1) + lbl.Font = Enum.Font.GothamBold + lbl.TextSize = 10 + lbl.Text = "["..kl.key.."] "..kl.label + end +end + +print("════════════════════════════════════════════") +print(" MINI CALL OF DUTY - 20 WEAPONS LOADED!") +print(" Press F5 (Play) to start the game") +print(" WASD=Move LMB=Shoot RMB=ADS") +print(" Shift=Sprint Ctrl=Crouch R=Reload") +print(" Keys 1-6 = Assault Rifles") +print(" Keys 7,8,9,0 = SMGs") +print(" Keys Q,E,T = Snipers") +print(" Keys Z,X = Shotguns") +print(" Keys C,V = LMGs") +print(" Keys B,N = Pistols") +print(" Key G = RPG-7 Launcher") +print("════════════════════════════════════════════") diff --git a/roblox-fps-p1-map.lua b/roblox-fps-p1-map.lua new file mode 100644 index 0000000..88559f1 --- /dev/null +++ b/roblox-fps-p1-map.lua @@ -0,0 +1,25 @@ +-- CLEAN + MAP ONLY (~2500 chars) +for _,v in pairs({"GameServer","FPS_HUD","WeaponClient","WeaponController","PlayerSetup"}) do +local s=game.ServerScriptService:FindFirstChild(v)if s then s:Destroy() end +local g=game.StarterGui:FindFirstChild(v)if g then g:Destroy() end +local p=game.StarterPlayer.StarterPlayerScripts:FindFirstChild(v)if p then p:Destroy() end +end +if game.ReplicatedStorage:FindFirstChild("Shared")then game.ReplicatedStorage.Shared:Destroy()end +if game.ReplicatedStorage:FindFirstChild("Events")then game.ReplicatedStorage.Events:Destroy()end +for _,v in pairs(workspace:GetChildren())do +if v:IsA("Model")or v:IsA("Part")or v:IsA("Folder")then +if v.Name~="Camera"and v.Name~="Terrain"then v:Destroy()end +end +end +wait(0.3) +local g=Instance.new("Part",workspace)g.Name="Ground"g.Size=Vector3.new(400,2,400)g.Position=Vector3.new(0,-1,0)g.Anchored=true g.BrickColor=BrickColor.new("Dark stone grey")g.Material=Enum.Material.Concrete +local wd={{n="N",s={400,20,2},p={0,10,-200}},{n="S",s={400,20,2},p={0,10,200}},{n="E",s={2,20,400},p={200,10,0}},{n="W",s={2,20,400},p={-200,10,0}}} +for _,w in ipairs(wd)do local wl=Instance.new("Part",workspace)wl.Name=w.n.."Wall"wl.Size=Vector3.new(unpack(w.s))wl.Position=Vector3.new(unpack(w.p))wl.Anchored=true wl.BrickColor=BrickColor.new("Dark stone grey")wl.Material=Enum.Material.Concrete wl.Transparency=0.3 end +local bd={{n="Bld_Alpha",s={30,20,25},p={-60,10,-80}},{n="Bld_Bravo",s={25,18,30},p={70,9,-60}},{n="Bld_Charlie",s={35,22,20},p={-40,11,70}},{n="Bld_Delta",s={20,16,35},p={80,8,80}},{n="Bld_Echo",s={28,24,28},p={0,12,-150}}} +for _,b in ipairs(bd)do local m=Instance.new("Model",workspace)m.Name=b.n local p=Instance.new("Part",m)p.Size=Vector3.new(unpack(b.s))p.Position=Vector3.new(unpack(b.p))p.Anchored=true p.BrickColor=BrickColor.new("Medium stone grey")p.Material=Enum.Material.Brick end +local cp={{-20,1,0},{20,1,0},{0,1,-30},{0,1,30},{-50,1,20},{50,1,-20},{-30,1,-50},{30,1,50},{-80,1,0},{80,1,0},{0,1,-80},{0,1,80},{-10,1,-120},{10,1,120},{-100,1,-40},{100,1,40},{-60,1,40},{60,1,-40},{-40,1,-120},{40,1,120},{110,1,0},{-110,1,0},{0,1,110},{0,1,-110}} +for i,c in ipairs(cp)do local p=Instance.new("Part",workspace)if i%3==0 then p.Size=Vector3.new(3,4,3)p.Position=Vector3.new(c[1],c[2]+2,c[3])p.BrickColor=BrickColor.new("Reddish brown")p.Material=Enum.Material.Metal p.Shape=Enum.PartType.Cylinder p.Orientation=Vector3.new(0,0,90)elseif i%3==1 then p.Size=Vector3.new(5,5,5)p.Position=Vector3.new(c[1],c[2]+2.5,c[3])p.BrickColor=BrickColor.new("Brown")p.Material=Enum.Material.Wood else p.Size=Vector3.new(8,3,3)p.Position=Vector3.new(c[1],c[2]+1.5,c[3])p.BrickColor=BrickColor.new("Brick yellow")p.Material=Enum.Material.Sand end p.Anchored=true p.Name="Cover"..i end +for i,t in ipairs({{-120,0,-120},{120,0,-120},{-120,0,120},{120,0,120}})do local m=Instance.new("Model",workspace)m.Name="Tower"..i local b=Instance.new("Part",m)b.Size=Vector3.new(6,1,6)b.Position=Vector3.new(t[1],0.5,t[3])b.Anchored=true for _,o in ipairs({{-2,0,-2},{2,0,-2},{-2,0,2},{2,0,2}})do local l=Instance.new("Part",m)l.Size=Vector3.new(1,15,1)l.Position=Vector3.new(t[1]+o[1],7.5,t[3]+o[2])l.Anchored=true l.BrickColor=BrickColor.new("Dark stone grey")end local pl=Instance.new("Part",m)pl.Size=Vector3.new(8,1,8)pl.Position=Vector3.new(t[1],15,t[3])pl.Anchored=true pl.BrickColor=BrickColor.new("Brown")end +for _,sp in ipairs({{0,3,170},{-30,3,170},{30,3,170}})do local s=Instance.new("SpawnLocation",workspace)s.Size=Vector3.new(6,1,6)s.Position=Vector3.new(unpack(sp))s.Anchored=true s.CanCollide=false s.Transparency=1 s.Name="SpawnPoint"end +game:GetService("Lighting").ClockTime=17.5 game:GetService("Lighting").Brightness=0.5 game:GetService("Lighting").FogEnd=500 game:GetService("Lighting").FogStart=200 +print("MAP DONE") diff --git a/roblox-fps-p2-data.lua b/roblox-fps-p2-data.lua new file mode 100644 index 0000000..d435001 --- /dev/null +++ b/roblox-fps-p2-data.lua @@ -0,0 +1,28 @@ +-- SHARED DATA + WEAPON MODULE (~2800 chars) +local sh=Instance.new("Folder",game.ReplicatedStorage)sh.Name="Shared" +local ev=Instance.new("Folder",game.ReplicatedStorage)ev.Name="Events" +for _,n in ipairs({"HitEvent","KillEvent","DamageEvent","WeaponSwitchEvent","ReloadEvent","PlayerDiedEvent","EnemyKilledEvent","HitMarkerEvent"})do Instance.new("RemoteEvent",ev).Name=n end +local wd=Instance.new("ModuleScript",sh)wd.Name="WeaponData" +wd.Source=[[local W={ +{Name="M4A1 Carbine",Category="AR",Key=Enum.KeyCode.One,Damage=25,HeadMulti=2.5,FireRate=0.1,MagSize=30,ReloadTime=2.2,Spread=0.02,ADS_Spread=0.008,Recoil=0.3,Range=300,Auto=true}, +{Name="AK-47",Category="AR",Key=Enum.KeyCode.Two,Damage=28,HeadMulti=2.5,FireRate=0.12,MagSize=30,ReloadTime=2.5,Spread=0.03,ADS_Spread=0.012,Recoil=0.45,Range=280,Auto=true}, +{Name="FN SCAR-H",Category="AR",Key=Enum.KeyCode.Three,Damage=33,HeadMulti=2.5,FireRate=0.11,MagSize=20,ReloadTime=2.6,Spread=0.025,ADS_Spread=0.01,Recoil=0.4,Range=320,Auto=true}, +{Name="M16A4",Category="AR",Key=Enum.KeyCode.Four,Damage=30,HeadMulti=2.8,FireRate=0.075,MagSize=30,ReloadTime=2.3,Spread=0.015,ADS_Spread=0.005,Recoil=0.35,Range=350,Auto=false,BurstCount=3}, +{Name="FAMAS F1",Category="AR",Key=Enum.KeyCode.Five,Damage=24,HeadMulti=2.5,FireRate=0.065,MagSize=25,ReloadTime=2.1,Spread=0.025,ADS_Spread=0.01,Recoil=0.35,Range=270,Auto=true}, +{Name="HK G36C",Category="AR",Key=Enum.KeyCode.Six,Damage=26,HeadMulti=2.5,FireRate=0.09,MagSize=30,ReloadTime=2.2,Spread=0.02,ADS_Spread=0.008,Recoil=0.3,Range=300,Auto=true}, +{Name="MP5A4",Category="SMG",Key=Enum.KeyCode.Seven,Damage=20,HeadMulti=2,FireRate=0.08,MagSize=30,ReloadTime=1.8,Spread=0.035,ADS_Spread=0.015,Recoil=0.15,Range=150,Auto=true}, +{Name="FN P90",Category="SMG",Key=Enum.KeyCode.Eight,Damage=21,HeadMulti=2,FireRate=0.065,MagSize=50,ReloadTime=2.5,Spread=0.04,ADS_Spread=0.018,Recoil=0.18,Range=140,Auto=true}, +{Name="HK MP7A2",Category="SMG",Key=Enum.KeyCode.Nine,Damage=19,HeadMulti=2,FireRate=0.07,MagSize=40,ReloadTime=2.0,Spread=0.03,ADS_Spread=0.012,Recoil=0.12,Range=130,Auto=true}, +{Name="UMP-45",Category="SMG",Key=Enum.KeyCode.Zero,Damage=23,HeadMulti=2,FireRate=0.11,MagSize=25,ReloadTime=2.0,Spread=0.04,ADS_Spread=0.018,Recoil=0.22,Range=160,Auto=true}, +{Name="AWP",Category="Sniper",Key=Enum.KeyCode.Q,Damage=95,HeadMulti=3,FireRate=1.4,MagSize=10,ReloadTime=3.5,Spread=0.001,ADS_Spread=0,Recoil=2.0,Range=800,Auto=false,ScopeZoom=8}, +{Name="Barrett M82",Category="Sniper",Key=Enum.KeyCode.E,Damage=150,HeadMulti=3,FireRate=1.8,MagSize=5,ReloadTime=4.0,Spread=0.002,ADS_Spread=0.001,Recoil=3.5,Range=1000,Auto=false,ScopeZoom=10}, +{Name="SVD Dragunov",Category="Sniper",Key=Enum.KeyCode.T,Damage=55,HeadMulti=2.8,FireRate=0.5,MagSize=10,ReloadTime=3.0,Spread=0.005,ADS_Spread=0.002,Recoil=1.2,Range=600,Auto=false,ScopeZoom=4}, +{Name="SPAS-12",Category="Shotgun",Key=Enum.KeyCode.Z,Damage=15,HeadMulti=1.5,FireRate=0.9,MagSize=8,ReloadTime=3.5,Spread=0.1,ADS_Spread=0.08,Recoil=1.5,Range=40,Auto=false,Pellets=8}, +{Name="Remington 870",Category="Shotgun",Key=Enum.KeyCode.X,Damage=18,HeadMulti=1.5,FireRate=1.0,MagSize=6,ReloadTime=3.0,Spread=0.12,ADS_Spread=0.09,Recoil=1.8,Range=35,Auto=false,Pellets=6}, +{Name="M249 SAW",Category="LMG",Key=Enum.KeyCode.C,Damage=28,HeadMulti=2,FireRate=0.08,MagSize=100,ReloadTime=5.5,Spread=0.05,ADS_Spread=0.025,Recoil=0.5,Range=350,Auto=true}, +{Name="M134 Minigun",Category="LMG",Key=Enum.KeyCode.V,Damage=18,HeadMulti=1.8,FireRate=0.04,MagSize=200,ReloadTime=8.0,Spread=0.07,ADS_Spread=0.04,Recoil=0.35,Range=250,Auto=true}, +{Name="Desert Eagle",Category="Pistol",Key=Enum.KeyCode.B,Damage=45,HeadMulti=3,FireRate=0.3,MagSize=7,ReloadTime=1.8,Spread=0.03,ADS_Spread=0.015,Recoil=0.8,Range=100,Auto=false}, +{Name="Glock 18C",Category="Pistol",Key=Enum.KeyCode.N,Damage=18,HeadMulti=2,FireRate=0.05,MagSize=20,ReloadTime=1.5,Spread=0.04,ADS_Spread=0.02,Recoil=0.15,Range=60,Auto=true}, +{Name="RPG-7",Category="Launcher",Key=Enum.KeyCode.G,Damage=200,HeadMulti=1,FireRate=2.0,MagSize=1,ReloadTime=4.5,Spread=0.01,ADS_Spread=0.005,Recoil=3.0,Range=200,Auto=false,Explosive=true,BlastRadius=20}, +}return W]] +print("WEAPON DATA DONE") diff --git a/roblox-fps-p3-server.lua b/roblox-fps-p3-server.lua new file mode 100644 index 0000000..864cdac --- /dev/null +++ b/roblox-fps-p3-server.lua @@ -0,0 +1,50 @@ +-- GAME SERVER SCRIPT (~3000 chars) +local gs=Instance.new("Script",game.ServerScriptService)gs.Name="GameServer" +gs.Source=[[ +local RS=game:GetService("ReplicatedStorage")local P=game:GetService("Players") +local E=RS:WaitForChild("Events") +local HE=E.HitEvent KE=E.KillEvent DE=E.DamageEvent PDE=E.PlayerDiedEvent EKE=E.EnemyKilledEvent HME=E.HitMarkerEvent +P.PlayerAdded:Connect(function(pl) +local ls=Instance.new("Folder",pl)ls.Name="leaderstats" +local k=Instance.new("IntValue",ls)k.Name="Kills"k.Value=0 +local d=Instance.new("IntValue",ls)d.Name="Deaths"d.Value=0 +pl.CharacterAdded:Connect(function(c) +local h=c:WaitForChild("Humanoid")h.MaxHealth=100 h.Health=100 h.WalkSpeed=18 +h.Died:Connect(function()d.Value=d.Value+1 PDE:FireClient(pl,pl.Name)task.delay(4,function()pl:LoadCharacter()end)end) +end)end) +HE.OnServerEvent:Connect(function(pl,hp,dmg,hs,wn) +if hp and hp.Parent and hp.Parent:FindFirstChild("Humanoid")then +local hm=hp.Parent.Humanoid if hm and hm.Health>0 then +local d=hs and dmg*2.5 or dmg hm:TakeDamage(d)HME:FireClient(pl,hs) +local tp=P:GetPlayerFromCharacter(hp.Parent) +if tp and tp~=pl then DE:FireClient(tp,d)end +if hm.Health<=0 then KE:FireClient(pl,"Enemy")pl.leaderstats.Kills.Value=pl.leaderstats.Kills.Value+1 end +end end end) +EKE.OnServerEvent:Connect(function(pl,en) +if pl and pl:FindFirstChild("leaderstats")then pl.leaderstats.Kills.Value=pl.leaderstats.Kills.Value+1 end end) +local MX=10 +local SP={Vector3.new(-150,3,-150),Vector3.new(150,3,-150),Vector3.new(-150,3,150),Vector3.new(150,3,150),Vector3.new(0,3,-150),Vector3.new(0,3,150),Vector3.new(-150,3,0),Vector3.new(150,3,0),Vector3.new(-100,3,-100),Vector3.new(100,3,100)} +local PP={Vector3.new(-60,3,-80),Vector3.new(70,3,-60),Vector3.new(-40,3,70),Vector3.new(80,3,80),Vector3.new(0,3,-150),Vector3.new(-120,3,-120),Vector3.new(120,3,-120),Vector3.new(-120,3,120),Vector3.new(120,3,120),Vector3.new(0,3,0)} +local function mkEnemy(sp) +local m=Instance.new("Model",workspace)m.Name="EnemySoldier" +local t=Instance.new("Part",m)t.Name="Torso"t.Size=Vector3.new(3,3,2)t.Position=sp t.BrickColor=BrickColor.new("Dark green")t.Material=Enum.Material.Plastic +local h=Instance.new("Part",m)h.Name="Head"h.Size=Vector3.new(2,2,2)h.Position=sp+Vector3.new(0,2.5,0)h.BrickColor=BrickColor.new("Medium stone grey") +local ll=Instance.new("Part",m)ll.Name="Left Leg"ll.Size=Vector3.new(1,3,1)ll.Position=sp+Vector3.new(-0.75,-2.5,0)ll.BrickColor=BrickColor.new("Dark green") +local rl=Instance.new("Part",m)rl.Name="Right Leg"rl.Size=Vector3.new(1,3,1)rl.Position=sp+Vector3.new(0.75,-2.5,0)rl.BrickColor=BrickColor.new("Dark green") +local hm=Instance.new("Humanoid",m)hm.MaxHealth=100 hm.Health=100 hm.WalkSpeed=12 +local rp=Instance.new("Part",m)rp.Name="HumanoidRootPart"rp.Size=Vector3.new(2,2,1)rp.Position=sp rp.Transparency=1 rp.CanCollide=false +local w1=Instance.new("Weld",rp)w1.Part0=rp w1.Part1=t +local w2=Instance.new("Weld",t)w2.Part0=t w2.Part1=h +local tp=PP[math.random(#PP)] +hm.Died:Connect(function() +for _,p in ipairs(P:GetPlayers())do local c=p.Character if c and c:FindFirstChild("HumanoidRootPart")then EKE:FireClient(p,m.Name)end end +task.delay(8,function()if m and m.Parent then m:Destroy()end end) +task.delay(12,function()local cnt=0 for _,o in pairs(workspace:GetChildren())do if o.Name=="EnemySoldier"then cnt=cnt+1 end end if cnt0 do task.wait(0.5)local r=m:FindFirstChild("HumanoidRootPart")if r then hm:MoveTo(tp)if(r.Position-tp).Magnitude<5 then tp=PP[math.random(#PP)]end end end end)() +coroutine.wrap(function()local ls=0 while m.Parent and hm.Health>0 do task.wait(0.3)local r=m:FindFirstChild("HumanoidRootPart")if not r then continue end for _,pl in ipairs(P:GetPlayers())do if pl.Character and pl.Character:FindFirstChild("HumanoidRootPart")then local pr=pl.Character.HumanoidRootPart local d=(pr.Position-r.Position).Magnitude if d<60 then hm:MoveTo(pr.Position)if d<45 and tick()-ls>1.5 then ls=tick()local ph=pl.Character:FindFirstChild("Humanoid")if ph and ph.Health>0 then ph:TakeDamage(8+math.random(7))DE:FireClient(pl,10)end end elseif d>90 then hm:MoveTo(tp)end end end end end)() +end +for i=1,MX do task.delay(i*0.5,function()mkEnemy(SP[i])end)end +print("[GameServer] Loaded!") +]] +print("SERVER DONE") diff --git a/roblox-fps-p4-hud.lua b/roblox-fps-p4-hud.lua new file mode 100644 index 0000000..5676c3e --- /dev/null +++ b/roblox-fps-p4-hud.lua @@ -0,0 +1,28 @@ +-- HUD GUI + PLAYER SETUP (~2800 chars) +local hud=Instance.new("ScreenGui",game.StarterGui)hud.Name="FPS_HUD"hud.ResetOnSpawn=false hud.ZIndexBehavior=Enum.ZIndexBehavior.Sibling +local ch=Instance.new("Frame",hud)ch.Name="Crosshair"ch.Size=UDim2.new(0,20,0,2)ch.Position=UDim2.new(0.5,-10,0.5,-1)ch.BackgroundColor3=Color3.new(1,1,1)ch.BorderSizePixel=0 +local cv=Instance.new("Frame",hud)cv.Name="CrosshairV"cv.Size=UDim2.new(0,2,0,20)cv.Position=UDim2.new(0.5,-1,0.5,-10)cv.BackgroundColor3=Color3.new(1,1,1)cv.BorderSizePixel=0 +local hm=Instance.new("Frame",hud)hm.Name="HitMarker"hm.Size=UDim2.new(0,30,0,30)hm.Position=UDim2.new(0.5,-15,0.5,-15)hm.BackgroundTransparency=1 hm.Visible=false +local h1=Instance.new("Frame",hm)h1.Size=UDim2.new(0,15,0,3)h1.Position=UDim2.new(0,15,0,0)h1.Rotation=45 h1.BackgroundColor3=Color3.new(1,1,1)h1.BorderSizePixel=0 +local h2=Instance.new("Frame",hm)h2.Size=UDim2.new(0,15,0,3)h2.Position=UDim2.new(0,0,0,15)h2.Rotation=45 h2.BackgroundColor3=Color3.new(1,1,1)h2.BorderSizePixel=0 +local hbf=Instance.new("Frame",hud)hbf.Name="HealthFrame"hbf.Size=UDim2.new(0,250,0,30)hbf.Position=UDim2.new(0,20,1,-60)hbf.BackgroundColor3=Color3.fromRGB(30,30,30)hbf.BorderSizePixel=0 hbf.BackgroundTransparency=0.3 +local hfl=Instance.new("Frame",hbf)hfl.Name="HealthFill"hfl.Size=UDim2.new(1,0,1,0)hfl.BackgroundColor3=Color3.fromRGB(0,200,0)hfl.BorderSizePixel=0 +local htx=Instance.new("TextLabel",hbf)htx.Name="HealthText"htx.Size=UDim2.new(1,0,1,0)htx.BackgroundTransparency=1 htx.TextColor3=Color3.new(1,1,1)htx.TextStrokeTransparency=0.5 htx.Font=Enum.Font.GothamBold htx.TextSize=16 htx.Text="100 HP" +local af=Instance.new("Frame",hud)af.Name="AmmoFrame"af.Size=UDim2.new(0,200,0,60)af.Position=UDim2.new(1,-220,1,-80)af.BackgroundTransparency=1 +local at=Instance.new("TextLabel",af)at.Name="AmmoText"at.Size=UDim2.new(1,0,0.6,0)at.BackgroundTransparency=1 at.TextColor3=Color3.new(1,1,1)at.TextStrokeTransparency=0.5 at.Font=Enum.Font.GothamBold at.TextSize=28 at.TextXAlignment=Enum.TextXAlignment.Right at.Text="30 / 30" +local wn=Instance.new("TextLabel",af)wn.Name="WeaponName"wn.Size=UDim2.new(1,0,0.4,0)wn.Position=UDim2.new(0,0.6,0)wn.BackgroundTransparency=1 wn.TextColor3=Color3.fromRGB(200,200,200)wn.TextStrokeTransparency=0.7 wn.Font=Enum.Font.Gotham wn.TextSize=14 wn.TextXAlignment=Enum.TextXAlignment.Right wn.Text="M4A1 Carbine" +local rb=Instance.new("Frame",hud)rb.Name="ReloadBar"rb.Size=UDim2.new(0,200,0,6)rb.Position=UDim2.new(0.5,-100,1,-120)rb.BackgroundColor3=Color3.fromRGB(60,60,60)rb.BorderSizePixel=0 rb.Visible=false rb.BackgroundTransparency=0.3 +local rf=Instance.new("Frame",rb)rf.Name="Fill"rf.Size=UDim2.new(0,0,1,0)rf.BackgroundColor3=Color3.fromRGB(255,200,0)rf.BorderSizePixel=0 +local rt=Instance.new("TextLabel",hud)rt.Name="ReloadText"rt.Size=UDim2.new(0,200,0,20)rt.Position=UDim2.new(0.5,-100,1,-140)rt.BackgroundTransparency=1 rt.TextColor3=Color3.fromRGB(255,200,0)rt.Font=Enum.Font.GothamBold rt.TextSize=14 rt.Text="RELOADING..."rt.Visible=false +local kf=Instance.new("Frame",hud)kf.Name="KillFeed"kf.Size=UDim2.new(0,250,0,200)kf.Position=UDim2.new(1,-260,0,10)kf.BackgroundTransparency=1 +Instance.new("UIListLayout",kf) +local sf=Instance.new("Frame",hud)sf.Name="ScoreFrame"sf.Size=UDim2.new(0,200,0,40)sf.Position=UDim2.new(0.5,-100,0,10)sf.BackgroundColor3=Color3.fromRGB(20,20,20)sf.BackgroundTransparency=0.5 sf.BorderSizePixel=0 +local st=Instance.new("TextLabel",sf)st.Name="ScoreText"st.Size=UDim2.new(1,0,1,0)st.BackgroundTransparency=1 st.TextColor3=Color3.new(1,1,1)st.Font=Enum.Font.GothamBold st.TextSize=20 st.Text="KILLS: 0" +local sb=Instance.new("TextLabel",hud)sb.Name="StreakBanner"sb.Size=UDim2.new(0,400,0,60)sb.Position=UDim2.new(0.5,-200,0.3,0)sb.BackgroundTransparency=1 sb.TextColor3=Color3.fromRGB(255,50,50)sb.Font=Enum.Font.GothamBold sb.TextSize=36 sb.TextStrokeTransparency=0.3 sb.Text=""sb.Visible=false +local vi=Instance.new("ImageLabel",hud)vi.Name="DamageVignette"vi.Size=UDim2.new(1,0,1,0)vi.BackgroundTransparency=1 vi.ImageTransparency=1 vi.Image="rbxassetid://1489679531"vi.ImageColor3=Color3.new(1,0,0) +local mm=Instance.new("Frame",hud)mm.Name="Minimap"mm.Size=UDim2.new(0,150,0,150)mm.Position=UDim2.new(0,10,0,10)mm.BackgroundColor3=Color3.fromRGB(20,20,30)mm.BorderSizePixel=2 mm.BorderColor3=Color3.fromRGB(100,100,100) +local md=Instance.new("Frame",mm)md.Name="PlayerDot"md.Size=UDim2.new(0,6,0,6)md.Position=UDim2.new(0.5,-3,0.5,-3)md.BackgroundColor3=Color3.fromRGB(0,150,255)md.BorderSizePixel=0 md.Shape=Enum.UIRectShape.Circle +local wl=Instance.new("Frame",hud)wl.Name="WeaponList"wl.Size=UDim2.new(0,500,0,25)wl.Position=UDim2.new(0.5,-250,1,-25)wl.BackgroundColor3=Color3.fromRGB(15,15,15)wl.BackgroundTransparency=0.5 wl.BorderSizePixel=0 +local cats={{"[1-6] AR",Color3.fromRGB(100,150,255)},{"[7-0] SMG",Color3.fromRGB(100,255,100)},{"[QET] SNIPER",Color3.fromRGB(255,100,100)},{"[ZX] SHOTGUN",Color3.fromRGB(255,200,50)},{"[CV] LMG",Color3.fromRGB(200,100,255)},{"[BNG] PISTOL/RPG",Color3.fromRGB(255,150,100)}} +for i,c in ipairs(cats)do local l=Instance.new("TextLabel",wl)l.Size=UDim2.new(1/#cats,0,1,0)l.Position=UDim2.new((i-1)/#cats,0,0,0)l.BackgroundColor3=c[2]l.BackgroundTransparency=0.7 l.TextColor3=Color3.new(1,1,1)l.Font=Enum.Font.GothamBold l.TextSize=10 l.Text=c[1]end +print("HUD DONE") diff --git a/roblox-fps-p5-player.lua b/roblox-fps-p5-player.lua new file mode 100644 index 0000000..170d107 --- /dev/null +++ b/roblox-fps-p5-player.lua @@ -0,0 +1,49 @@ +-- PLAYER SETUP SCRIPT (~2500 chars) +local ps=Instance.new("LocalScript",game.StarterPlayer.StarterPlayerScripts)ps.Name="PlayerSetup" +ps.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 pl=P.LocalPlayer local cam=workspace.CurrentCamera +pl.CharacterAdded:Connect(function(c) +local h=c:WaitForChild("Humanoid")local rp=c:WaitForChild("HumanoidRootPart") +RS.RenderStepped:Connect(function() +if h.Health>0 then cam.CameraType=Enum.CameraType.LockFirstPerson local hd=c:FindFirstChild("Head")if hd then cam.CFrame=hd.CFrame end end +end) +local sp=false cr=false +UI.InputBegan:Connect(function(i,g)if g then return end +if i.KeyCode==Enum.KeyCode.LeftShift then sp=true h.WalkSpeed=28 +elseif i.KeyCode==Enum.KeyCode.LeftControl then cr=true h.WalkSpeed=8 end end) +UI.InputEnded:Connect(function(i) +if i.KeyCode==Enum.KeyCode.LeftShift then sp=false h.WalkSpeed=cr and 8 or 18 +elseif i.KeyCode==Enum.KeyCode.LeftControl then cr=false h.WalkSpeed=sp and 28 or 18 end end) +end) +local E=RepS:WaitForChild("Events") +local KE=E:WaitForChild("KillEvent")local DE=E:WaitForChild("DamageEvent")local HME=E:WaitForChild("HitMarkerEvent") +KE.OnClientEvent:Connect(function(k) +local hd=pl:WaitForChild("PlayerGui"):WaitForChild("FPS_HUD")local kf=hd:FindFirstChild("KillFeed") +local e=Instance.new("TextLabel",kf)e.Size=UDim2.new(1,0,0,20)e.BackgroundColor3=Color3.fromRGB(0,0,0)e.BackgroundTransparency=0.5 e.TextColor3=Color3.new(1,1,1)e.Font=Enum.Font.GothamBold e.TextSize=13 e.Text=pl.Name.." eliminated "..(k or "Enemy")e.TextXAlignment=Enum.TextXAlignment.Right +game:GetService("Debris"):AddItem(e,5)end) +DE.OnClientEvent:Connect(function(d) +local hd=pl.PlayerGui:FindFirstChild("FPS_HUD")local v=hd and hd:FindFirstChild("DamageVignette") +if v then v.ImageTransparency=0.3 TS:Create(v,TweenInfo.new(0.8),{ImageTransparency=1}):Play()end end) +HME.OnClientEvent:Connect(function(hs) +local hd=pl.PlayerGui:FindFirstChild("FPS_HUD")local m=hd and hd:FindFirstChild("HitMarker") +if m then m.Visible=true for _,c in pairs(m:GetChildren())do c.BackgroundColor3=hs and Color3.fromRGB(255,50,50)or Color3.new(1,1,1)end task.delay(0.15,function()m.Visible=false end)end end) +RS.RenderStepped:Connect(function() +local hd=pl.PlayerGui:FindFirstChild("FPS_HUD")if not hd then return end +local mm=hd:FindFirstChild("Minimap")if not mm then return end +local c=pl.Character if not c or not c:FindFirstChild("HumanoidRootPart")then return end +local pos=c.HumanoidRootPart.Position +for _,x in pairs(mm:GetChildren())do if x.Name=="EnemyDot"then x:Destroy()end end +local dt=mm:FindFirstChild("PlayerDot")if dt then dt.Position=UDim2.new(0,(pos.X/400+0.5)*150-3,0,(pos.Z/400+0.5)*150-3)end +for _,o in pairs(workspace:GetChildren())do +if o:IsA("Model")and o.Name=="EnemySoldier"and o:FindFirstChild("HumanoidRootPart")then +local ep=o.HumanoidRootPart.Position if(ep-pos).Magnitude<100 then +local d=Instance.new("Frame",mm)d.Name="EnemyDot"d.Size=UDim2.new(0,4,0,4)d.Position=UDim2.new(0,(ep.X/400+0.5)*150-2,0,(ep.Z/400+0.5)*150-2)d.BackgroundColor3=Color3.new(1,0,0)d.BorderSizePixel=0 d.Shape=Enum.UIRectShape.Circle end end end +if c:FindFirstChild("Humanoid")then +local hh=c.Humanoid local hf=hd:FindFirstChild("HealthFrame") +if hf then local fl=hf:FindFirstChild("HealthFill")local tx=hf:FindFirstChild("HealthText") +if fl then fl.Size=UDim2.new(hh.Health/hh.MaxHealth,0,1,0)if hh.Health>60 then fl.BackgroundColor3=Color3.fromRGB(0,200,0)elseif hh.Health>30 then fl.BackgroundColor3=Color3.fromRGB(255,200,0)else fl.BackgroundColor3=Color3.fromRGB(255,0,0)end end +if tx then tx.Text=math.floor(hh.Health).." HP"end end end end end) +print("[PlayerSetup] Loaded!") +]] +print("PLAYER SETUP DONE") diff --git a/roblox-fps-p6-weapons.lua b/roblox-fps-p6-weapons.lua new file mode 100644 index 0000000..77d837f --- /dev/null +++ b/roblox-fps-p6-weapons.lua @@ -0,0 +1,60 @@ +-- 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")