Fifkee

Bonnie from FNAF2 code in ROBLOX.

Mar 15th, 2018
187
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 4.84 KB | None | 0 0
  1. local Bonnie = workspace:WaitForChild("Bonnie") --Model w/ a Torso
  2. local gamevalues = game.ReplicatedStorage.GameValues --Folder
  3. local hoodStatus = gamevalues.hoodStatus --Boolean
  4. local oRoom = gamevalues.occupyingRoom --String
  5. local isO = gamevalues.isOccupied -- Boolean
  6. local hoodTimer = gamevalues.hoodTimer --NumberValue
  7. local location = 0
  8. local Vents = false
  9. --Heyy, don't mind the skid code.
  10. --If it errors, it's because you tried to copy and paste this without making an effort so it can work. Don't come crying to me if it's broken.
  11. --Otherwise, dm scar#8268 on discord or Fifkee on roblox if you have any questions, or if I missed a function that bonnie has.
  12. --Remade the script, was extremely buggy. It's stable now.
  13. --NOTE: Bonnie, Chica, Toy Bonnie, Toy Chica, Balloon Boy, and Mangle go in the vents. NOBODY ELSE.
  14. --holy heck thats a lot of people.
  15. game:GetService('RunService').RenderStepped:connect(function(step)
  16.     if location < 0 then
  17.         location = 0
  18.     elseif location > 4 then
  19.         location = 4
  20.     end
  21.     if location < 0 and Vents then
  22.         location = 0
  23.     elseif location > 2 and Vents then
  24.         location = 2
  25.     end
  26.     if not Vents then
  27.         if location + 1 == 5 then
  28.             Bonnie.Torso.CFrame = CFrame.new(
  29.                 workspace["Room"].CFrame.X,
  30.                 workspace["Room"].CFrame.Y + 1,
  31.                 workspace["Room"].CFrame.Z)
  32.             *
  33.                 CFrame.Angles(Bonnie.Torso.CFrame:toEulerAnglesXYZ()
  34.             )
  35.         else
  36.             Bonnie.Torso.CFrame = CFrame.new(
  37.         workspace["Bonnie"..location].CFrame.X,
  38.         workspace["Bonnie"..location].CFrame.Y + 1,
  39.         workspace["Bonnie"..location].CFrame.Z)
  40.         *
  41.         CFrame.Angles(Bonnie.Torso.CFrame:toEulerAnglesXYZ()
  42.         )
  43.         end
  44.     elseif Vents then
  45.         if location + 1 >= 3 then
  46.             Bonnie.Torso.CFrame = CFrame.new(
  47.                 workspace["Room"].CFrame.X,
  48.                 workspace["Room"].CFrame.Y + 1,
  49.                 workspace["Room"].CFrame.Z)
  50.             *
  51.                 CFrame.Angles(Bonnie.Torso.CFrame:toEulerAnglesXYZ()
  52.             )
  53.         else
  54.             Bonnie.Torso.CFrame = CFrame.new(
  55.                 workspace["LeftVent"..location].CFrame.X,
  56.                 workspace["LeftVent"..location].CFrame.Y + 1,
  57.                 workspace["LeftVent"..location].CFrame.Z)
  58.                 *
  59.                 CFrame.Angles(Bonnie.Torso.CFrame:toEulerAnglesXYZ()
  60.             )
  61.         end
  62.     end
  63. end)
  64. spawn(function(s2)
  65.     gamevalues.isOccupied.Changed:connect(function(change)
  66.         wait(2)
  67.         if isO.Value == true and oRoom.Value == "Bonnie" then
  68.             if hoodStatus.Value ~= true then
  69.                 print('Dead Bonnie')
  70.             else
  71.                 wait()
  72.                 Vents = false
  73.                 --TODO:Putting camera down
  74.                 location = 0
  75.                 isO.Value = not isO.Value
  76.                 oRoom.Value = ""
  77.                 print('Alive Bonnie')
  78.                 game.Players.LocalPlayer.PlayerGui.SoundAssets["In-Room Static"]:Stop()
  79.             end
  80.         end
  81.     end)
  82. end)
  83. spawn(function(s)
  84.     while wait(math.random(1, 5)) do -- 2, 3,4,5, 6,7
  85.         local itemsrun = {
  86.             ["2"] = true,
  87.             ["7"] = true,
  88.             ["3"] = true
  89.         }
  90.         local itemsretreat = {
  91.             ["9"] = true
  92.         }
  93.         local enterVent = math.random(8, 13)
  94.         local ventItems = {
  95.             ["8"] = true,
  96.             ["9"] = true,
  97.             ["10"] = true
  98.         }
  99.         local variable = math.random(2, 15)--math.random(2, 7)
  100.         if not Vents then
  101.             if itemsrun[tostring(variable)] then
  102.                 if location + 1 == 4 and isO.Value == true then
  103.                     do
  104.                     end
  105.                 elseif location == 1 and ventItems[tostring(enterVent)] then
  106.                 --//Entering Vents\\--
  107.                     if ventItems[tostring(enterVent)] and gamevalues.leftVentOccupied.Value ~= true then
  108.                         print('Vent Entered')
  109.                         local Sound = game.Players.LocalPlayer.PlayerGui.SoundAssets.ventMovement1:Clone()
  110.                         Vents = true
  111.                         location = 0
  112.                     elseif gamevalues.leftVentOccupied.Value == true and ventItems[tostring(enterVent)] then
  113.                         print("Bonnie: Would've entered vent, but someone's occupying it. (Left)")
  114.                     end
  115.                 elseif location + 1 == 5 then
  116.                     if isO.Value == false then
  117.                         --//Is in room--\\
  118.                         game.Players.LocalPlayer.PlayerGui.SoundAssets["In-Room Static"]:Play()
  119.                         location = location + 1
  120.                         print'yesinroomBNHallway'
  121.                         isO.Value = true
  122.                         oRoom.Value = "Bonnie"
  123.                     else
  124.                         if oRoom.Value ~= "Bonnie" then
  125.                             location = 0
  126.                         end
  127.                     end
  128.                 else
  129.                     location = location + 1
  130.                     print('Moving one step.'..location)
  131.                 end
  132.             --//Going Back\\--
  133. --          elseif itemsretreat[tostring(variable)] then
  134. --              if oRoom.Value == "Bonnie" then
  135. --                  print('isinroom')
  136. --              else
  137. --                  location = location - 1
  138. --                  print'nay'
  139. --              end
  140. --          end
  141.             --print(location, variable)
  142.         end
  143.         elseif Vents then
  144.             print('vents')
  145.             if itemsrun[tostring(variable)] then
  146.                 if location + 1 == 2 and isO.Value == true then
  147.                     do
  148.                     end
  149.                 elseif location + 1 == 3 then
  150.                     print'yesinroomBNVents'
  151.                     isO.Value = true
  152.                     oRoom.Value = "Bonnie"
  153.                 else
  154.                     local Sound = game.Players.LocalPlayer.PlayerGui.SoundAssets.ventMovement1:Clone()
  155.                     Sound.Parent = Bonnie
  156.                     Sound:Remove()
  157.                     location = location + 1
  158.                 end
  159.             end    
  160.         end
  161.     end
  162. end)
Advertisement
Add Comment
Please, Sign In to add comment