Thecodeeasar

Among us(Sus*very)

Nov 21st, 2024
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.39 KB | None | 0 0
  1. -- Clear existing baseplate and terrain
  2. local workspaceChildren = workspace:GetChildren()
  3. for _, child in ipairs(workspaceChildren) do
  4. if child:IsA("Terrain") or child.Name == "Baseplate" then
  5. child:Destroy()
  6. end
  7. end
  8.  
  9. -- Create the map
  10. local function createMap()
  11. local mapBase = Instance.new("Part")
  12. mapBase.Size = Vector3.new(200, 1, 200)
  13. mapBase.Position = Vector3.new(0, 0, 0)
  14. mapBase.Anchored = true
  15. mapBase.Material = Enum.Material.SmoothPlastic
  16. mapBase.BrickColor = BrickColor.Gray()
  17. mapBase.Name = "MapBase"
  18. mapBase.Parent = workspace
  19.  
  20. -- Example rooms and walls
  21. local rooms = {
  22. {size = Vector3.new(50, 1, 50), pos = Vector3.new(-75, 0.5, -75)},
  23. {size = Vector3.new(50, 1, 50), pos = Vector3.new(75, 0.5, -75)},
  24. {size = Vector3.new(50, 1, 50), pos = Vector3.new(-75, 0.5, 75)},
  25. {size = Vector3.new(50, 1, 50), pos = Vector3.new(75, 0.5, 75)}
  26. }
  27.  
  28. for _, room in ipairs(rooms) do
  29. local floor = Instance.new("Part")
  30. floor.Size = room.size
  31. floor.Position = room.pos
  32. floor.Anchored = true
  33. floor.Material = Enum.Material.SmoothPlastic
  34. floor.BrickColor = BrickColor.White()
  35. floor.Name = "RoomFloor"
  36. floor.Parent = workspace
  37. end
  38. end
  39.  
  40. createMap()
  41.  
  42. -- Add NPCs with AI
  43. local function createNPC(role, position)
  44. local npc = Instance.new("Model")
  45. npc.Name = "NPC_" .. role
  46.  
  47. local npcHead = Instance.new("Part")
  48. npcHead.Size = Vector3.new(2, 2, 2)
  49. npcHead.Position = position
  50. npcHead.Anchored = false
  51. npcHead.Material = Enum.Material.Neon
  52. npcHead.BrickColor = role == "Imposter" and BrickColor.Red() or BrickColor.Green()
  53. npcHead.Name = "Head"
  54. npcHead.Parent = npc
  55.  
  56. local humanoid = Instance.new("Humanoid")
  57. humanoid.Parent = npc
  58.  
  59. npc.Parent = workspace
  60.  
  61. -- NPC Behavior
  62. spawn(function()
  63. while true do
  64. wait(math.random(2, 5)) -- Random idle time
  65. if role == "Crewmate" then
  66. -- Perform a "task"
  67. npcHead.BrickColor = BrickColor.Blue() -- Task animation simulation
  68. wait(2)
  69. npcHead.BrickColor = BrickColor.Green()
  70. elseif role == "Imposter" then
  71. -- Sabotage or hunt
  72. if math.random(1, 3) == 1 then
  73. -- Sabotage
  74. print("Imposter " .. npc.Name .. " sabotages!")
  75. local sabotagePart = Instance.new("Part")
  76. sabotagePart.Size = Vector3.new(20, 1, 20)
  77. sabotagePart.Anchored = true
  78. sabotagePart.Position = Vector3.new(0, 5, 0)
  79. sabotagePart.Material = Enum.Material.Neon
  80. sabotagePart.BrickColor = BrickColor.Black()
  81. sabotagePart.Name = "SabotageZone"
  82. sabotagePart.Parent = workspace
  83. wait(5)
  84. sabotagePart:Destroy()
  85. else
  86. -- Hunt players
  87. local players = game.Players:GetPlayers()
  88. for _, player in ipairs(players) do
  89. local character = player.Character
  90. if character and (character.PrimaryPart.Position - npcHead.Position).Magnitude < 10 then
  91. print("Imposter attacked " .. player.Name)
  92. break
  93. end
  94. end
  95. end
  96. end
  97. end
  98. end)
  99. end
  100.  
  101. -- Spawn NPCs
  102. for i = 1, 5 do
  103. local role = i % 2 == 0 and "Imposter" or "Crewmate"
  104. local position = Vector3.new(math.random(-50, 50), 5, math.random(-50, 50))
  105. createNPC(role, position)
  106. end
  107.  
  108. -- Player Tasks Example
  109. local function createTask(position)
  110. local task = Instance.new("Part")
  111. task.Size = Vector3.new(5, 1, 5)
  112. task.Position = position
  113. task.Anchored = true
  114. task.Material = Enum.Material.SmoothPlastic
  115. task.BrickColor = BrickColor.Blue()
  116. task.Name = "Task"
  117. task.Parent = workspace
  118.  
  119. task.Touched:Connect(function(hit)
  120. local player = game.Players:GetPlayerFromCharacter(hit.Parent)
  121. if player then
  122. print(player.Name .. " completed a task!")
  123. end
  124. end)
  125. end
  126.  
  127. createTask(Vector3.new(0, 1, 0)) -- Add a task in the center
  128.  
Advertisement
Add Comment
Please, Sign In to add comment