Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local SoundService = game:GetService("SoundService")
- local musicToDecrease = game.Workspace.ParadiseFalls
- local soundLoadedEvent = Instance.new("BindableEvent")
- local sound = game.StarterPlayer.StarterPlayerScripts.DoorOpening.Horror
- local StoneDoorSoundId = "rbxassetid://1843660604"
- local Hinge = workspace.Door1.PrimaryPart
- local Door = workspace.Door1
- local TweenSetvice = game:GetService("TweenService")
- local musicTweenInfo = TweenInfo.new(1, Enum.EasingStyle.Linear, Enum.EasingDirection.InOut, 0)
- local MusicVolumeGoal = {
- Volume = 0
- }
- local MusicVolumeIncreaseGoal = {
- Volume = 0.3
- }
- local decreaseMusicTween = TweenSetvice:Create(musicToDecrease, musicTweenInfo, MusicVolumeGoal)
- local IncreaseMusicTween = TweenSetvice:Create(musicToDecrease, musicTweenInfo, MusicVolumeIncreaseGoal)
- local primary = game.Workspace.DoorsFigureKiller.PrimaryPart
- local Ghost = game.Workspace.DoorsFigureKiller
- local light = game.Workspace.GhostLight
- local Debounce = false
- local startTimeToSkip = 5
- local ShakeEvent = game.ReplicatedStorage:WaitForChild("ShakeEvent")
- local ShowHorrorImage = game.ReplicatedStorage:WaitForChild("ShowImage")
- local opened = false
- local Promt = workspace.Door1:WaitForChild("ProximityPrompt")
- -- this will open the door if it is close and close if it is already opened
- function OpenDoor()
- if opened == false then
- opened = true
- for i = 1, 18 do
- Door:SetPrimaryPartCFrame(Hinge.CFrame*CFrame.Angles(0, math.rad(5), 0))
- wait()
- end
- else
- opened = false
- for i = 1, 18 do
- Door:SetPrimaryPartCFrame(Hinge.CFrame*CFrame.Angles(0, math.rad(-5), 0))
- wait()
- end
- end
- end
- -- Moving Ghost
- local LightTweenInfo = TweenInfo.new(1, Enum.EasingStyle.Linear, Enum.EasingDirection.InOut, 0, false)
- local LightTarget = {
- CFrame = light.CFrame + Vector3.new(light.Size.X + 30, 0, 0)
- }
- local GhostTweenInfo = TweenInfo.new(1, Enum.EasingStyle.Linear, Enum.EasingDirection.InOut, 0, false)
- local target = {
- CFrame = primary.CFrame + Vector3.new(primary.Size.X + 30, 0, 0)
- }
- local GhostTween = TweenSetvice:Create(primary, GhostTweenInfo, target)
- local LightTween = TweenSetvice:Create(light, LightTweenInfo, LightTarget)
- -- This function will run first time when player open the door and than player see ghost moving toward wall and they ghost destroy
- Promt.Triggered:Connect(function(player)
- if not Debounce then
- Debounce = true
- OpenDoor()
- task.wait(1)
- GhostTween:Play()
- LightTween:Play()
- local character = player.Character or player.CharacterAdded:Wait()
- local Humanoid = character:WaitForChild("Humanoid")
- local torso = character:FindFirstChild("Torso") or character:FindFirstChild("UpperTorso")
- local playerGui = player:WaitForChild("PlayerGui")
- local gui = playerGui:WaitForChild("ScreenGui")
- if torso then
- while wait() do
- if Humanoid.Health == 0 then
- OpenDoor()
- return
- end
- local distance = (Door.Hinge.Position - torso.Position).magnitude
- if distance > 25 then
- ShakeEvent.OnClientEvent:Connect(function(Time)
- sound.TimePosition = startTimeToSkip
- sound:Play()
- decreaseMusicTween:Play()
- local StartTime = tick()
- repeat
- wait()
- local EndTime = tick()
- local xOffset = math.random(-100, 100) / 500
- local yOffset = math.random(-100, 100) / 500
- local zOffset = math.random(-100, 100) / 500
- Humanoid.CameraOffset = Vector3.new(xOffset, yOffset, zOffset)
- until EndTime - StartTime >= Time
- Humanoid.CameraOffset = Vector3.new(0, 0, 0)
- end)
- wait(2)
- gui.Enabled = true
- local blur = Instance.new("BlurEffect")
- blur.Parent = game.Lighting -- [IMPORTANT:] Do NOT change the parent otherwise it won't work.
- blur.Size = 6
- wait(2) -- How long the shake effect is for
- blur.Size = 5
- wait(0.1) -- You change this if you want
- blur.Size = 4
- wait(0.1) -- You change this if you want
- blur.Size = 3
- wait(0.1) -- You change this if you want
- blur.Size = 2
- wait(0.1) -- You change this if you want
- blur.Size = 1
- wait(0.1) -- You change this if you want
- blur.Size = 0
- blur:Destroy()
- if Humanoid.Health ~= 0 then
- Humanoid:TakeDamage(Humanoid.MaxHealth)
- end
- gui.Enabled = false
- sound:Pause()
- OpenDoor()
- wait(1)
- IncreaseMusicTween:Play()
- return
- end
- end
- end
- end
- end)
- LightTween.Completed:Connect(function()
- light:Destroy()
- end)
- GhostTween.Completed:Connect(function()
- Ghost:Destroy()
- end)
- -- This function will run when player open the door second time so player will not able to see ghost again and again
- Promt.Triggered:Connect(function(player)
- if Debounce then
- OpenDoor()
- local character = player.Character or player.CharacterAdded:Wait()
- local Humanoid = character:WaitForChild("Humanoid")
- local torso = character:FindFirstChild("Torso") or character:FindFirstChild("UpperTorso")
- local playerGui = player:WaitForChild("PlayerGui")
- local gui = playerGui:WaitForChild("ScreenGui")
- if torso then
- while wait() do
- if Humanoid.Health == 0 then
- OpenDoor()
- end
- local distance = (Door.Hinge.Position - torso.Position).magnitude
- if distance > 25 then
- ShakeEvent.OnClientEvent:Connect(function(Time)
- local StartTime = tick()
- repeat
- wait()
- local EndTime = tick()
- local xOffset = math.random(-100, 100) / 500
- local yOffset = math.random(-100, 100) / 500
- local zOffset = math.random(-100, 100) / 500
- Humanoid.CameraOffset = Vector3.new(xOffset, yOffset, zOffset)
- until EndTime - StartTime >= Time
- Humanoid.CameraOffset = Vector3.new(0, 0, 0)
- end)
- wait(2)
- gui.Enabled = true
- local blur = Instance.new("BlurEffect")
- blur.Parent = game.Lighting -- [IMPORTANT:] Do NOT change the parent otherwise it won't work.
- blur.Size = 6
- wait(2) -- How long the shake effect is for
- blur.Size = 5
- wait(0.1) -- You change this if you want
- blur.Size = 4
- wait(0.1) -- You change this if you want
- blur.Size = 3
- wait(0.1) -- You change this if you want
- blur.Size = 2
- wait(0.1) -- You change this if you want
- blur.Size = 1
- wait(0.1) -- You change this if you want
- blur.Size = 0
- blur:Destroy()
- Humanoid:TakeDamage(Humanoid.MaxHealth)
- gui.Enabled = false
- OpenDoor()
- return
- end
- end
- end
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement