Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- LOCAL SCRIPT --
- local tweenService = game:GetService("TweenService")
- local userInputService = game:GetService("UserInputService")
- local replicatedStorage = game:GetService("ReplicatedStorage")
- local event = replicatedStorage:WaitForChild("HideEvent")
- local player = game.Players.LocalPlayer
- local character = player.Character or player.CharacterAdded:Wait()
- local effect = script.Parent.Effect
- local camera = workspace.CurrentCamera
- local keyConnection = nil
- local keys = {Enum.KeyCode.W, Enum.KeyCode.A, Enum.KeyCode.D, Enum.KeyCode.S}
- event.OnClientEvent:Connect(function(model)
- camera.CameraType = Enum.CameraType.Scriptable
- camera.CameraSubject = model.InsideCamera
- for i, v in pairs(character:GetDescendants()) do
- if v:IsA("BasePart") or v:IsA("Decal") then
- v.Transparency = 1
- end
- end
- local tweenInfo = TweenInfo.new(1, Enum.EasingStyle.Sine, Enum.EasingDirection.InOut)
- tweenService:Create(camera, tweenInfo, {CFrame = model.InsideCamera.CFrame}):Play()
- for i = 1, 0, -0.01 do
- effect.BackgroundTransparency = i
- task.wait()
- end
- task.wait(0.7)
- keyConnection = userInputService.InputBegan:Connect(function(input)
- if table.find(keys, input.KeyCode) then
- keyConnection:Disconnect()
- event:FireServer(model)
- local tweenInfo = TweenInfo.new(1, Enum.EasingStyle.Sine, Enum.EasingDirection.InOut)
- tweenService:Create(camera, tweenInfo, {CFrame = model.OutsideCamera.CFrame}):Play()
- task.spawn(function()
- for i = 0, 1, 0.01 do
- effect.BackgroundTransparency = i
- task.wait()
- end
- end)
- task.wait(tweenInfo.Time)
- camera.CameraType = Enum.CameraType.Custom
- camera.CameraSubject = character
- for i, v in pairs(character:GetDescendants()) do
- if v.Name ~= "HumanoidRootPart" and (v:IsA("BasePart") or v:IsA("Decal")) then
- v.Transparency = 0
- end
- end
- end
- end)
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement