Advertisement
MandB

Horror Game Part 2

Sep 3rd, 2021
185
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.34 KB | None | 0 0
  1. --DoorScript
  2.  
  3. local Door = script.Parent
  4.  
  5. local TweenService = game:GetService("TweenService")
  6. local Info = TweenInfo.new(0.5,Enum.EasingStyle.Linear,Enum.EasingDirection.Out,0,false,0)
  7.  
  8. local DoorOpenPosition = script.Parent.Parent.OpenPosition
  9. local DoorClosePosition = script.Parent.Parent.ClosedPosition
  10.  
  11. local DoorOpenTween = TweenService:Create(Door,Info,{CFrame = DoorOpenPosition.CFrame})
  12. local DoorClosedTween = TweenService:Create(Door,Info,{CFrame = DoorClosePosition.CFrame})
  13.  
  14. script.Parent.Touched:Connect(function(hit)
  15. if hit and hit.Parent.Name == "OfficeKey" then
  16. DoorOpenTween:Play()
  17. hit.Parent:Destroy()
  18. end
  19. end)
  20.  
  21. --FoundOfficeTrigger
  22.  
  23. script.Parent.Touched:Connect(function(hit)
  24. if hit and hit.Parent:FindFirstChild("Humanoid") then
  25. script.Parent:Destroy()
  26. end
  27. end)
  28.  
  29. --MainGameScriptUpdated
  30.  
  31. --Updated Script
  32.  
  33. local DialogueEvent = game.ReplicatedStorage.RemoteEvents:FindFirstChild("DialogueEvent")
  34. local ObjectiveEvent = game.ReplicatedStorage.RemoteEvents:FindFirstChild("ObjectivEvent")
  35. local TransitionEvent = game.ReplicatedStorage.RemoteEvents:FindFirstChild("TransitionEvent")
  36.  
  37. local ToggleDialogueEvent = game.ReplicatedStorage.RemoteEvents:FindFirstChild("ToggleDialogueEvent")
  38. local ToggelObjectiveEvent = game.ReplicatedStorage.RemoteEvents:FindFirstChild("ToggleObjectiveEvent")
  39.  
  40.  
  41.  
  42.  
  43.  
  44. local function MainGame()
  45. ToggleDialogueEvent:FireAllClients(true)
  46. DialogueEvent:FireAllClients("I Need To Find The MainRoom")--What the dialogue says
  47. wait(4)
  48. ToggleDialogueEvent:FireAllClients(false)
  49. ToggelObjectiveEvent:FireAllClients(true)
  50. ObjectiveEvent:FireAllClients("Find The Main Room")--What the objective is
  51.  
  52. repeat wait() until game.Workspace.Triggers.DialogueTriggers:FindFirstChild("FoundOfficeTrigger") == nil
  53.  
  54. ToggleDialogueEvent:FireAllClients(true)
  55. ToggelObjectiveEvent:FireAllClients(false)
  56. DialogueEvent:FireAllClients("Darn I Need A key Better Keep Looking Around")
  57. wait(4)
  58. ToggleDialogueEvent:FireAllClients(false)
  59. ToggelObjectiveEvent:FireAllClients(true)
  60. ObjectiveEvent:FireAllClients("Find The Key")
  61.  
  62. TransitionEvent:FireAllClients()
  63. wait(2)
  64.  
  65. end
  66.  
  67. wait(2)
  68. MainGame()
  69.  
  70. --ToolScript
  71.  
  72.  
  73. local tool = script.Parent.Parent
  74.  
  75. local function click(player)
  76. tool.Parent = game.Workspace[player.Name]
  77. end
  78.  
  79. script.Parent.ClickDetector.MouseClick:Connect(click)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement