Files
ClaudeCode-Roblox-Studio-MCP/examples/fps-game/part1_map.lua
Admin a66533206f Add FPS game example, auto-connect plugin, and Python injection tools
- Updated RobloxMCPPlugin with HTTP polling (auto-enables HttpService)
- Added 20-weapon FPS game example (CoD-style)
- Added Python studio-inject.py for command bar injection via Win32 API
- Added auto-connect setup scripts (VBS + PowerShell)
- Updated MCP server with all FPS game tools

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

243 lines
11 KiB
Lua

-- ═══════════════════════════════════════════════════════════════════
-- MINI CALL OF DUTY - FPS Game Setup (Part 1: Map + Infrastructure)
-- Inject into Roblox Studio Command Bar
-- ═══════════════════════════════════════════════════════════════════
-- Clean workspace
for _, c in ipairs(workspace:GetChildren()) do
if not c:IsA("Terrain") and not c:IsA("Camera") then c:Destroy() end
end
-- Clean services
for _, c in ipairs(game:GetService("ReplicatedStorage"):GetChildren()) do c:Destroy() end
for _, c in ipairs(game:GetService("StarterGui"):GetChildren()) do c:Destroy() end
for _, c in ipairs(game:GetService("ServerScriptService"):GetChildren()) do c:Destroy() end
for _, s in ipairs({"StarterPlayerScripts", "StarterPlayer"}) do
local f = game:GetService("StarterPlayer"):FindFirstChild(s)
if f then for _, c in ipairs(f:GetChildren()) do c:Destroy() end end
end
local Lighting = game:GetService("Lighting")
for _, c in ipairs(Lighting:GetChildren()) do c:Destroy() end
-- ═══════════════════════════════════════════════════════════════
-- FOLDERS & REMOTES
-- ═══════════════════════════════════════════════════════════════
local RS = game:GetService("ReplicatedStorage")
local events = Instance.new("Folder") events.Name = "Events" events.Parent = RS
Instance.new("RemoteEvent", events).Name = "ShootEvent"
Instance.new("RemoteEvent", events).Name = "HitEvent"
Instance.new("RemoteEvent", events).Name = "KillEvent"
Instance.new("RemoteEvent", events).Name = "DamageEvent"
Instance.new("RemoteEvent", events).Name = "ReloadEvent"
Instance.new("RemoteFunction", events).Name = "GetGameData"
local shared = Instance.new("Folder") shared.Name = "Shared" shared.Parent = RS
local assets = Instance.new("Folder") assets.Name = "Assets" assets.Parent = RS
-- ═══════════════════════════════════════════════════════════════
-- MAP BUILDING - Urban Military Zone
-- ═══════════════════════════════════════════════════════════════
local mapModel = Instance.new("Model") mapModel.Name = "Map" mapModel.Parent = workspace
local function P(props)
local p = Instance.new("Part")
p.Anchored = true
p.TopSurface = Enum.SurfaceType.Smooth
p.BottomSurface = Enum.SurfaceType.Smooth
for k,v in pairs(props) do p[k] = v end
p.Parent = props.Parent or mapModel
return p
end
local function W(props)
local w = Instance.new("WedgePart")
w.Anchored = true
for k,v in pairs(props) do w[k] = v end
w.Parent = props.Parent or mapModel
return w
end
-- Ground
P({Name="Ground", Size=Vector3.new(400,2,400), Position=Vector3.new(0,-1,0),
Color=Color3.fromRGB(80,78,70), Material=Enum.Material.Asphalt})
-- Spawn area
P({Name="SpawnPad", Size=Vector3.new(20,1,20), Position=Vector3.new(0,0.5,-160),
Color=Color3.fromRGB(30,120,30), Material=Enum.Material.SmoothPlastic})
local spawnLoc = Instance.new("SpawnLocation")
spawnLoc.Name = "PlayerSpawn"
spawnLoc.Size = Vector3.new(8,1,8)
spawnLoc.Position = Vector3.new(0,1,-155)
spawnLoc.Anchored = true
spawnLoc.CanCollide = false
spawnLoc.Transparency = 0.5
spawnLoc.Color = Color3.fromRGB(0,255,0)
spawnLoc.Parent = mapModel
-- ─── BUILDINGS ───
local function makeBuilding(x, z, w, d, h, color)
local bldg = Instance.new("Model") bldg.Name = "Building" bldg.Parent = mapModel
-- Floor
P({Name="Floor", Size=Vector3.new(w,1,d), Position=Vector3.new(x,0.5,z),
Color=Color3.fromRGB(100,95,85), Material=Enum.Material.SmoothPlastic, Parent=bldg})
-- Walls
P({Name="WallN", Size=Vector3.new(w,h,1), Position=Vector3.new(x,h/2+1,z-d/2),
Color=color, Material=Enum.Material.Brick, Parent=bldg})
P({Name="WallS", Size=Vector3.new(w,h,1), Position=Vector3.new(x,h/2+1,z+d/2),
Color=color, Material=Enum.Material.Brick, Parent=bldg})
P({Name="WallE", Size=Vector3.new(1,h,d), Position=Vector3.new(x+w/2,h/2+1,z),
Color=color, Material=Enum.Material.Brick, Parent=bldg})
P({Name="WallW", Size=Vector3.new(1,h,d), Position=Vector3.new(x-w/2,h/2+1,z),
Color=color, Material=Enum.Material.Brick, Parent=bldg})
-- Roof
P({Name="Roof", Size=Vector3.new(w+2,1,d+2), Position=Vector3.new(x,h+1,z),
Color=Color3.fromRGB(60,55,50), Material=Enum.Material.CorrodedMetal, Parent=bldg})
-- Door opening (destroy wall segment)
-- Window holes
P({Name="WinN1", Size=Vector3.new(4,3,1.2), Position=Vector3.new(x+3,h/2,z-d/2),
Color=Color3.fromRGB(135,135,135), Material=Enum.Material.SmoothPlastic, Parent=bldg})
P({Name="WinN2", Size=Vector3.new(4,3,1.2), Position=Vector3.new(x-3,h/2,z-d/2),
Color=Color3.fromRGB(135,135,135), Material=Enum.Material.SmoothPlastic, Parent=bldg})
return bldg
end
-- Main buildings
makeBuilding(-50, -60, 30, 20, 12, Color3.fromRGB(140,130,120)) -- HQ building
makeBuilding(50, -60, 25, 25, 10, Color3.fromRGB(130,125,115)) -- Barracks
makeBuilding(-50, 40, 20, 30, 14, Color3.fromRGB(120,115,110)) -- Tower building
makeBuilding(50, 50, 28, 22, 10, Color3.fromRGB(125,120,110)) -- Warehouse
makeBuilding(0, 50, 22, 18, 8, Color3.fromRGB(145,135,125)) -- Center building
-- Ruined building (half walls)
P({Name="RuinedWall1", Size=Vector3.new(12,6,1), Position=Vector3.new(-20,3,0),
Color=Color3.fromRGB(100,95,85), Material=Enum.Material.Brick})
P({Name="RuinedWall2", Size=Vector3.new(1,4,8), Position=Vector3.new(-14,2,-4),
Color=Color3.fromRGB(100,95,85), Material=Enum.Material.Brick})
P({Name="RuinedFloor", Size=Vector3.new(15,1,10), Position=Vector3.new(-20,0.5,0),
Color=Color3.fromRGB(90,85,75), Material=Enum.Material.Concrete})
-- ─── COVER OBJECTS ───
local coverPositions = {
{-30,-120, 4,3,8}, {30,-120, 4,3,8}, {-10,-100, 6,2,4}, {10,-100, 6,2,4},
{-40,-30, 3,2,6}, {40,-30, 3,2,6}, {-25,10, 5,2,3}, {25,10, 5,2,3},
{0,-20, 4,3,4}, {-15,30, 3,2,5}, {15,30, 3,2,5},
{-60,0, 4,3,8}, {60,0, 4,3,8},
{-35,80, 5,2,4}, {35,80, 5,2,4}, {0,80, 3,2,6},
{-20,-50, 3,2,3}, {20,-50, 3,2,3},
{-70,-60, 4,3,6}, {70,-60, 4,3,6},
{0,120, 6,2,4}, {-40,120, 4,3,5}, {40,120, 4,3,5},
}
for i, pos in ipairs(coverPositions) do
P({Name="Cover_"..i, Size=Vector3.new(pos[4],pos[5],pos[6]),
Position=Vector3.new(pos[1],pos[5]/2+0.5,pos[2]),
Color=Color3.fromRGB(90+i*2,85+i*2,75+i*2), Material=Enum.Material.Concrete})
end
-- ─── SANDBAG WALLS ───
for i = 1, 20 do
local angle = (i/20) * math.pi * 2
local r = 85
P({Name="Sandbag_"..i, Size=Vector3.new(6,3,3),
Position=Vector3.new(math.cos(angle)*r, 1.5, math.sin(angle)*r),
Orientation=Vector3.new(0, math.deg(angle), 0),
Color=Color3.fromRGB(160,145,110), Material=Enum.Material.Slate})
end
-- ─── WATCHTOWER ───
local function makeTower(x, z)
P({Name="TowerBase_"..x, Size=Vector3.new(6,0.5,6), Position=Vector3.new(x,8,z),
Color=Color3.fromRGB(80,70,60), Material=Enum.Material.Wood})
-- Legs
P({Name="Leg1", Size=Vector3.new(1,16,1), Position=Vector3.new(x-2,8,z-2),
Color=Color3.fromRGB(70,60,50), Material=Enum.Material.Wood})
P({Name="Leg2", Size=Vector3.new(1,16,1), Position=Vector3.new(x+2,8,z-2),
Color=Color3.fromRGB(70,60,50), Material=Enum.Material.Wood})
P({Name="Leg3", Size=Vector3.new(1,16,1), Position=Vector3.new(x-2,8,z+2),
Color=Color3.fromRGB(70,60,50), Material=Enum.Material.Wood})
P({Name="Leg4", Size=Vector3.new(1,16,1), Position=Vector3.new(x+2,8,z+2),
Color=Color3.fromRGB(70,60,50), Material=Enum.Material.Wood})
-- Railing
P({Name="Rail1", Size=Vector3.new(6,2,0.3), Position=Vector3.new(x,9,z-2.85),
Color=Color3.fromRGB(70,60,50), Material=Enum.Material.Wood})
P({Name="Rail2", Size=Vector3.new(6,2,0.3), Position=Vector3.new(x,9,z+2.85),
Color=Color3.fromRGB(70,60,50), Material=Enum.Material.Wood})
end
makeTower(-70, -80)
makeTower(70, -80)
makeTower(-70, 90)
makeTower(70, 90)
-- ─── CRATES ───
for i = 1, 15 do
local cx = math.random(-80, 80)
local cz = math.random(-140, 140)
P({Name="Crate_"..i, Size=Vector3.new(3,3,3),
Position=Vector3.new(cx, 1.5, cz),
Orientation=Vector3.new(0, math.random(0,90), 0),
Color=Color3.fromRGB(140,110,60), Material=Enum.Material.Wood})
end
-- ─── BARRELS ───
for i = 1, 10 do
local bx = math.random(-90, 90)
local bz = math.random(-140, 140)
P({Name="Barrel_"..i, Shape=Enum.PartType.Cylinder, Size=Vector3.new(3,3,3),
Position=Vector3.new(bx, 1.5, bz),
Orientation=Vector3.new(0, math.random(0,180), 90),
Color=Color3.fromRGB(50,60,50), Material=Enum.Material.SmoothPlastic})
end
-- ─── MAP BOUNDARY WALLS ───
P({Name="BorderN", Size=Vector3.new(200,15,3), Position=Vector3.new(0,7.5,-180),
Color=Color3.fromRGB(60,60,60), Material=Enum.Material.Concrete})
P({Name="BorderS", Size=Vector3.new(200,15,3), Position=Vector3.new(0,7.5,180),
Color=Color3.fromRGB(60,60,60), Material=Enum.Material.Concrete})
P({Name="BorderE", Size=Vector3.new(3,15,200), Position=Vector3.new(98,7.5,0),
Color=Color3.fromRGB(60,60,60), Material=Enum.Material.Concrete})
P({Name="BorderW", Size=Vector3.new(3,15,200), Position=Vector3.new(-98,7.5,0),
Color=Color3.fromRGB(60,60,60), Material=Enum.Material.Concrete})
-- ═══════════════════════════════════════════════════════════════
-- LIGHTING - Dusk/Battle Atmosphere
-- ═══════════════════════════════════════════════════════════════
Lighting.Ambient = Color3.fromRGB(80,75,70)
Lighting.OutdoorAmbient = Color3.fromRGB(100,90,80)
Lighting.Brightness = 1.2
Lighting.ClockTime = 17.5 -- Dusk
Lighting.FogEnd = 400
Lighting.FogStart = 50
Lighting.FogColor = Color3.fromRGB(140,130,120)
local atmo = Instance.new("Atmosphere")
atmo.Density = 0.25
atmo.Color = Color3.fromRGB(180,165,145)
atmo.Decay = Color3.fromRGB(120,110,100)
atmo.Glare = 0.3
atmo.Haze = 1.5
atmo.Parent = Lighting
-- Sun rays
local sunRays = Instance.new("SunRaysEffect")
sunRays.Intensity = 0.04
sunRays.Spread = 0.6
sunRays.Parent = Lighting
-- Bloom
local bloom = Instance.new("BloomEffect")
bloom.Intensity = 0.3
bloom.Size = 24
bloom.Threshold = 1.5
bloom.Parent = Lighting
-- Color correction (warm wartime tones)
local cc = Instance.new("ColorCorrectionEffect")
cc.Brightness = 0.02
cc.Contrast = 0.1
cc.Saturation = -0.15
cc.TintColor = Color3.fromRGB(255,240,220)
cc.Parent = Lighting
print("[CoD FPS] Part 1/5 complete: Map built, lighting set.")