Advertisement
munciseek

Untitled

Jan 3rd, 2025 (edited)
42
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.97 KB | None | 0 0
  1. local ReplicatedStorage = game:GetService("ReplicatedStorage")
  2. local Workspace = game:GetService("Workspace")
  3. local Players = game:GetService("Players")
  4. local Rooms = workspace.CurrentRooms[game:GetService("ReplicatedStorage").GameData.LatestRoom.Value]
  5. local Humanoid = Players.LocalPlayer.Character:FindFirstChildOfClass("Humanoid")
  6. local OGNodes = Rooms:FindFirstChild("PathfindNodes")
  7. if OGNodes then
  8. local NewNodes = OGNodes:Clone()
  9. NewNodes.Parent = Rooms
  10. NewNodes.Name = "Nodes"
  11. end
  12.  
  13. local EnableDamage = true
  14. local Spawn_HungerSound = false
  15.  
  16. local function setFPS(fps)
  17. if fps <= 0 then
  18. game:GetService("RunService"):Set3dRenderingEnabled(false)
  19. else
  20. game:GetService("RunService"):Set3dRenderingEnabled(true)
  21. local targetTime = 1/fps
  22. local start = tick()
  23. while tick() - start < targetTime do end
  24. end
  25. end
  26.  
  27. local Spawn = Instance.new("Sound", workspace)
  28. Spawn.SoundId = "rbxassetid://933230732"
  29. Spawn.Volume = 1
  30. Spawn.Name = "Hunger_SpawnSound"
  31.  
  32. game.Workspace.CurrentRooms.ChildAdded:Connect(function()
  33. local core = game.Workspace:FindFirstChild("Hunger")
  34. if core then core:Destroy() end
  35. EnableDamage = true
  36. end)
  37.  
  38. Spawn:Play()
  39. Spawn.Ended:Connect(function()
  40. Spawn:Destroy()
  41. Spawn_HungerSound = true
  42. local Hunger = game:GetObjects("rbxassetid://103184019870675")[1]
  43. Hunger.Name = "Hunger"
  44. local num = math.floor(#Rooms.Nodes:GetChildren() / 2)
  45. Hunger.CFrame = (num == 0 and Rooms.Base or Rooms.Nodes[num]).CFrame + Vector3.new(0, 3, 0)
  46. Hunger.Parent = Workspace
  47.  
  48. while EnableDamage and Hunger and Hunger.Parent do
  49. local _, found = workspace.CurrentCamera:WorldToScreenPoint(Hunger.Position)
  50. if not found and Humanoid and Humanoid.Health > 0 then
  51. Humanoid.Health -= 5
  52. if Hunger:FindFirstChild("Attack") then
  53. Hunger.Attack:Play()
  54. end
  55. setFPS(5)
  56. wait(0.1)
  57. setFPS(60)
  58. if Humanoid.Health <= 0 then
  59. ReplicatedStorage.GameStats["Player_"..Players.LocalPlayer.Name].Total.DeathCause.Value = "Hunger"
  60. firesignal(game.ReplicatedStorage.RemotesFolder.DeathHint.OnClientEvent, {
  61. "You died to Hunger",
  62. "You must look at it",
  63. "Keep going"
  64. }, "Blue")
  65. break
  66. end
  67. end
  68. wait(0.1)
  69. end
  70. end)
  71.  
  72. game:GetService("ReplicatedStorage").GameData.LatestRoom.Changed:Connect(function(v)
  73. if not Spawn_HungerSound then
  74. if Humanoid then
  75. Humanoid.Health = 0
  76. ReplicatedStorage.GameStats["Player_" .. Players.LocalPlayer.Name].Total.DeathCause.Value = "Hunger"
  77. firesignal(game.ReplicatedStorage.RemotesFolder.DeathHint.OnClientEvent, {"You died to Hunger","Don't open the next door during the hunger roar","Keep going"}, "Blue")
  78. end
  79. end
  80. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement