Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --ServerScriptService
- local DialogueEvent = game.ReplicatedStorage.RemoteEvents:FindFirstChild("DialogueEvent")
- local ObjectiveEvent = game.ReplicatedStorage.RemoteEvents:FindFirstChild("ObjectivEvent")
- local TransitionEvent = game.ReplicatedStorage.RemoteEvents:FindFirstChild("TransitionEvent")
- local ToggleDialogueEvent = game.ReplicatedStorage.RemoteEvents:FindFirstChild("ToggleDialogueEvent")
- local ToggelObjectiveEvent = game.ReplicatedStorage.RemoteEvents:FindFirstChild("ToggleObjectiveEvent")
- local IntroEvent = game.ReplicatedStorage.RemoteEvents:FindFirstChild("IntroEvent")
- local function Teleport(Position)
- local Players = game.Players:GetPlayers()
- for i, player in pairs(Players) do
- if player.Character then
- player.Character.Humanoid.Jump = true
- player.Character:SetPrimaryPartCFrame(Position)
- end
- end
- end
- local function MainGame()
- ToggleDialogueEvent:FireAllClients(true)
- DialogueEvent:FireAllClients("I Need To Find The MainRoom")--What the dialogue says
- wait(4)
- ToggleDialogueEvent:FireAllClients(false)
- ToggelObjectiveEvent:FireAllClients(true)
- ObjectiveEvent:FireAllClients("Find The Main Room")--What the objective is
- repeat wait() until game.Workspace.Triggers.DialogueTriggers:FindFirstChild("FoundOfficeTrigger") == nil
- ToggleDialogueEvent:FireAllClients(true)
- ToggelObjectiveEvent:FireAllClients(false)
- DialogueEvent:FireAllClients("Darn I Need A key Better Keep Looking Around")
- wait(4)
- ToggleDialogueEvent:FireAllClients(false)
- ToggelObjectiveEvent:FireAllClients(true)
- ObjectiveEvent:FireAllClients("Find The Key")
- repeat wait() until game.Workspace.Triggers.DialogueTriggers:FindFirstChild("FoundGymTrigger") == nil
- ToggleDialogueEvent:FireAllClients(true)
- ToggelObjectiveEvent:FireAllClients(false)
- DialogueEvent:FireAllClients("I Need To Unlock The SpareRoom To Get The Maze")
- wait(4)
- ToggleDialogueEvent:FireAllClients(false)
- ToggelObjectiveEvent:FireAllClients(true)
- ObjectiveEvent:FireAllClients("Unlock The SpareRoom")
- repeat wait() until game.Workspace.Triggers.DialogueTriggers:FindFirstChild("GymTrigger") == nil
- repeat wait() until game.Workspace.Triggers.DialogueTriggers:FindFirstChild("MazeDoorTrigger") == nil
- TransitionEvent:FireAllClients()
- wait(2)
- Teleport(game.Workspace.TeleportPoints.MazeExitTeleport.CFrame)
- Teleport(game.Workspace.TeleportPoints.MazeTeleport.CFrame)
- end
- wait(2)
- MainGame()
- game.Players.PlayerAdded:Connect(function(Player)
- IntroEvent:FireClient(Player)
- end)
- --DeathPart
- --Variables--
- local Brick = script.Parent
- --End--
- --Code--
- local function PlayerTouched(Part)
- local Parent = Part.Parent
- if game.Players:GetPlayerFromCharacter(Parent) then
- Parent.Humanoid.Health = 0
- end
- end
- Brick.Touched:connect(PlayerTouched)
- --FollowScript
- local Monster = script.Parent
- function FindPlayer(Position)
- local List = game.Workspace:GetChildren()
- local Torso = nil
- local Distance = 30
- local HumanoidRootPart = nil
- local Humanoid = nil
- local Player = nil
- for i = 1, #List do
- Player = List[i]
- if (Player.ClassName == "Model") and (Player ~= script.Parent) then
- HumanoidRootPart = Player:FindFirstChild("HumanoidRootPart")
- Humanoid = Player:FindFirstChild("Humanoid")
- if (HumanoidRootPart ~= nil) and (Humanoid ~= nil) and (Humanoid.Health > 0) then
- if (HumanoidRootPart.Position - Position).Magnitude < Distance then
- Torso = HumanoidRootPart
- Distance = (HumanoidRootPart.Position - Position).Magnitude
- end
- end
- end
- end
- return Torso
- end
- while true do
- wait(1)
- local Target = FindPlayer(script.Parent.HumanoidRootPart.Position)
- if Target ~= nil then
- script.Parent.Humanoid:MoveTo(Target.Position, Target)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement