Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Clear existing baseplate and terrain
- local workspaceChildren = workspace:GetChildren()
- for _, child in ipairs(workspaceChildren) do
- if child:IsA("Terrain") or child.Name == "Baseplate" then
- child:Destroy()
- end
- end
- -- Create the map
- local function createMap()
- local mapBase = Instance.new("Part")
- mapBase.Size = Vector3.new(200, 1, 200)
- mapBase.Position = Vector3.new(0, 0, 0)
- mapBase.Anchored = true
- mapBase.Material = Enum.Material.SmoothPlastic
- mapBase.BrickColor = BrickColor.Gray()
- mapBase.Name = "MapBase"
- mapBase.Parent = workspace
- -- Example rooms and walls
- local rooms = {
- {size = Vector3.new(50, 1, 50), pos = Vector3.new(-75, 0.5, -75)},
- {size = Vector3.new(50, 1, 50), pos = Vector3.new(75, 0.5, -75)},
- {size = Vector3.new(50, 1, 50), pos = Vector3.new(-75, 0.5, 75)},
- {size = Vector3.new(50, 1, 50), pos = Vector3.new(75, 0.5, 75)}
- }
- for _, room in ipairs(rooms) do
- local floor = Instance.new("Part")
- floor.Size = room.size
- floor.Position = room.pos
- floor.Anchored = true
- floor.Material = Enum.Material.SmoothPlastic
- floor.BrickColor = BrickColor.White()
- floor.Name = "RoomFloor"
- floor.Parent = workspace
- end
- end
- createMap()
- -- Add NPCs with AI
- local function createNPC(role, position)
- local npc = Instance.new("Model")
- npc.Name = "NPC_" .. role
- local npcHead = Instance.new("Part")
- npcHead.Size = Vector3.new(2, 2, 2)
- npcHead.Position = position
- npcHead.Anchored = false
- npcHead.Material = Enum.Material.Neon
- npcHead.BrickColor = role == "Imposter" and BrickColor.Red() or BrickColor.Green()
- npcHead.Name = "Head"
- npcHead.Parent = npc
- local humanoid = Instance.new("Humanoid")
- humanoid.Parent = npc
- npc.Parent = workspace
- -- NPC Behavior
- spawn(function()
- while true do
- wait(math.random(2, 5)) -- Random idle time
- if role == "Crewmate" then
- -- Perform a "task"
- npcHead.BrickColor = BrickColor.Blue() -- Task animation simulation
- wait(2)
- npcHead.BrickColor = BrickColor.Green()
- elseif role == "Imposter" then
- -- Sabotage or hunt
- if math.random(1, 3) == 1 then
- -- Sabotage
- print("Imposter " .. npc.Name .. " sabotages!")
- local sabotagePart = Instance.new("Part")
- sabotagePart.Size = Vector3.new(20, 1, 20)
- sabotagePart.Anchored = true
- sabotagePart.Position = Vector3.new(0, 5, 0)
- sabotagePart.Material = Enum.Material.Neon
- sabotagePart.BrickColor = BrickColor.Black()
- sabotagePart.Name = "SabotageZone"
- sabotagePart.Parent = workspace
- wait(5)
- sabotagePart:Destroy()
- else
- -- Hunt players
- local players = game.Players:GetPlayers()
- for _, player in ipairs(players) do
- local character = player.Character
- if character and (character.PrimaryPart.Position - npcHead.Position).Magnitude < 10 then
- print("Imposter attacked " .. player.Name)
- break
- end
- end
- end
- end
- end
- end)
- end
- -- Spawn NPCs
- for i = 1, 5 do
- local role = i % 2 == 0 and "Imposter" or "Crewmate"
- local position = Vector3.new(math.random(-50, 50), 5, math.random(-50, 50))
- createNPC(role, position)
- end
- -- Player Tasks Example
- local function createTask(position)
- local task = Instance.new("Part")
- task.Size = Vector3.new(5, 1, 5)
- task.Position = position
- task.Anchored = true
- task.Material = Enum.Material.SmoothPlastic
- task.BrickColor = BrickColor.Blue()
- task.Name = "Task"
- task.Parent = workspace
- task.Touched:Connect(function(hit)
- local player = game.Players:GetPlayerFromCharacter(hit.Parent)
- if player then
- print(player.Name .. " completed a task!")
- end
- end)
- end
- createTask(Vector3.new(0, 1, 0)) -- Add a task in the center
Advertisement
Add Comment
Please, Sign In to add comment