Im sorry to repost this. but nobody would read this.
I tried wait game.Loaded,Resources loading. This Still Happening
Studio:
Game:
GUI Script:
local Modules = game:GetService("ReplicatedStorage").Modules
local TweenService = game:GetService("TweenService")
local RbxUtil = Modules.Roblox
local CameraManager = require(RbxUtil.CameraManager)
local Util = require(Modules.Roblox.Utility)
local Lighting = game:GetService("Lighting")
local LocalPlayer = game:GetService("Players").LocalPlayer
LocalPlayer:SetAttribute("CanRun",false)
if not game:IsLoaded() then
game.Loaded:Wait()
end
repeat
workspace.CurrentCamera.CameraType = Enum.CameraType.Scriptable
until workspace.CurrentCamera.CameraType == Enum.CameraType.Scriptable
workspace:WaitForChild("Cameras")
CameraManager:StartTransitionScreenEffect()
CameraManager:EnableCameraControl()
spawn(function()
CameraManager:CameraMoveToAsync()
end)
function start()
--
workspace.CurrentCamera.CameraType = Enum.CameraType.Custom
workspace.CurrentCamera.CameraSubject = game.Players.LocalPlayer.Character:FindFirstChildWhichIsA("Humanoid")
--
local time = 0.5
Util.PropertyTweener(Lighting.MenuBlur,"Size",0,30,time,Util.EaseInOutQuad,true)
Util.PropertyTweener(Lighting.ColorCorrection,"Brightness",0,-1,time,Util.EaseInOutQuad,true)
Util.PropertyTweener(Lighting.ColorCorrection,"Saturation",0,1,time,Util.EaseInOutQuad,true)
wait(0.4)
Util.PropertyTweener(script.Parent.Background,"GroupTransparency",0,1,time,Util.EaseInOutQuad,true)
TweenService:Create(script.Parent.Background,TweenInfo.new(time),{
["Position"] = UDim2.new(0,0,0,40)
}):Play()
wait(1)
CameraManager:StopCameraMoveAsync()
Util.PropertyTweener(Lighting.MenuBlur,"Size",30,0,time,Util.EaseInOutQuad,true)
Util.PropertyTweener(Lighting.ColorCorrection,"Brightness",-1,0,time,Util.EaseInOutQuad,true)
Util.PropertyTweener(Lighting.ColorCorrection,"Saturation",1,0,time,Util.EaseInOutQuad,true)
end
script.Parent.Background.Warning.Start.MouseButton1Click:Connect(start)
CameraManager
-- Xbox One CameraManager
-- Written by Kip Turner, Copyright ROBLOX 2015
-- Edited by MeTooIDK
local CoreGui = game.Players.LocalPlayer.PlayerGui
local Modules = game.ReplicatedStorage:FindFirstChild("Modules").Roblox
local Utility = require(Modules:FindFirstChild('Utility'))
local GlobalSettings = require(Modules:FindFirstChild('GlobalSettings'))
local RunService = game:GetService("RunService")
local TaskCoro = false
local PlayAnimationCoro = nil
local PlatformService;
pcall(function() PlatformService = game:GetService('PlatformService') end)
local UserInputService = game:GetService('UserInputService')
local function clerp(x)
return (math.sin(math.pi * (x - 0.5)) + 1) * 0.5
end
local function clerp0(x)
return clerp(x * 0.5)
end
local function clerp1(x)
return clerp(x * 0.5 + 0.5)
end
local Coros = {}
local CameraManager = {}
function CameraManager:StartTransitionScreenEffect()
if PlatformService then
PlatformService.Brightness = GlobalSettings.SceneBrightness
PlatformService.Contrast = GlobalSettings.SceneContrast
PlatformService.GrayscaleLevel = GlobalSettings.SceneGrayscaleLevel
PlatformService.TintColor = GlobalSettings.SceneTintColor
PlatformService.BlurIntensity = GlobalSettings.SceneMotionBlurIntensity
end
end
function CameraManager:EndTransitionScreenEffect( ... )
-- if PlatformService then
-- PlatformService.Brightness = GlobalSettings.SceneBrightness
-- PlatformService.Contrast = GlobalSettings.SceneContrast
-- PlatformService.GrayscaleLevel = GlobalSettings.SceneGrayscaleLevel
-- PlatformService.TintColor = GlobalSettings.SceneTintColor
-- PlatformService.BlurIntensity = GlobalSettings.SceneBlurIntensity
-- end
end
local cameraConnection;
local camera = workspace.CurrentCamera
local function onCameraChanged()
if workspace.CurrentCamera then
camera = workspace.CurrentCamera
camera.CameraType = 'Scriptable'
end
end
local cameraChanged = workspace.Changed:connect(function(prop)
if prop == 'CurrentCamera' then
onCameraChanged()
end
end)
onCameraChanged()
local function CFrameBezierLerp(cframes, t)
local cframes2 = {}
for i = 1, #cframes - 1 do
cframes2[i] = cframes[i]:lerp(cframes[i + 1], t)
end
if #cframes2 == 1 then
return cframes2[1]
end
return CFrameBezierLerp(cframes2, t)
end
local cameraMoveCn = nil
local gamepadInput = Vector2.new(0, 0)
function CameraManager:EnableCameraControl()
cameraMoveCn = Utility.DisconnectEvent(cameraMoveCn)
cameraMoveCn = UserInputService.InputChanged:connect(function(input)
if input.KeyCode == Enum.KeyCode.Thumbstick2 then
gamepadInput = input.Position or gamepadInput
gamepadInput = Vector2.new(gamepadInput.X, gamepadInput.Y)
end
end)
end
function CameraManager:DisableCameraControl()
cameraMoveCn = Utility.DisconnectEvent(cameraMoveCn)
gamepadInput = Vector2.new(0, 0)
end
local getGamepadInputCFrame; do
local gamepadInputLerping = Vector2.new(0, 0)
local timestamp0 = tick()
function getGamepadInputCFrame()
local timestamp1 = tick()
local deltaTime = timestamp1 - timestamp0
timestamp0 = timestamp1
local unit = 0.125 ^ deltaTime
gamepadInputLerping = gamepadInputLerping * unit + gamepadInput * (1 - unit)
return CFrame.new(gamepadInputLerping.X/8, gamepadInputLerping.Y/8, 0) * CFrame.Angles(0, -gamepadInputLerping.X / 12, 0) * CFrame.Angles(gamepadInputLerping.Y / 12, 0, 0)
end
end
local function lerpToCFrame(cframes, length, useVelocity, yieldEarlyLength)
-- print("Lerpin")
local name = "CameraScriptCutsceneLerp"
yieldEarlyLength = yieldEarlyLength or 0
yieldEarlyLength = 1 - yieldEarlyLength / length
if useVelocity then
-- TODO: estimate the total distance traveled
--length = (cf0.p - cf1.p).magnitude / length
end
if cameraConnection then
cameraConnection:disconnect()
cameraConnection = nil
end
local timestamp0 = tick()
local event = Instance.new("BindableEvent")
cameraConnection = {
disconnect = function()
if event then
event:Fire()
event = nil
end
RunService:UnbindFromRenderStep(name)
end
}
RunService:BindToRenderStep(name, Enum.RenderPriority.Camera.Value, function()
local timestamp1 = tick()
local t = (timestamp1 - timestamp0) / length
if t >= 1 then
t = 1
end
--print(t)
local cam = Workspace.CurrentCamera
cam.CoordinateFrame = CFrameBezierLerp(cframes, t) * getGamepadInputCFrame()
if t >= 1 then
if event then
event:Fire()
event = nil
end
cameraConnection:disconnect()
elseif t >= yieldEarlyLength then
--local test = cf0:lerp(cf1, (t))
--print(test)
if event then
event:Fire()
event = nil
end
end
end)
event.Event:wait()
end
local function GetCameraParts(model)
local parts = {}
for i, part in pairs(model:GetChildren()) do
parts[tonumber(part.Name:sub(4, -1))] = part
part.Transparency = 1
end
return parts
end
local function PlayAnimationAsync(cameras, doTransition, isPan)
if #cameras <= 1 then
return
end
local cam = workspace.CurrentCamera
local time = 1.7
cam.CoordinateFrame = cameras[1].CFrame
if (doTransition) then
delay(time, function()
if PlatformService then
Utility.PropertyTweener(PlatformService, 'Contrast', PlatformService.Contrast, GlobalSettings.SceneContrast, time, Utility.EaseInOutQuad, true)
Utility.PropertyTweener(PlatformService, 'BlurIntensity', PlatformService.BlurIntensity, GlobalSettings.SceneMotionBlurIntensity, time, Utility.EaseInOutQuad, true)
end
end)
end
local cframes = {}
for i = 1, #cameras do
cframes[i] = cameras[i].CFrame * CFrame.new(0, 0, -cameras[i].Size.Z / 2)
end
lerpToCFrame(cframes, isPan and 60 or 120, false, time + 0.1)
-- lerpToCFrame(cframes, 15, false, time + 0.1)
if PlatformService then
Utility.PropertyTweener(PlatformService, 'Contrast', GlobalSettings.SceneContrast, -1, time, Utility.EaseInOutQuad, true)
Utility.PropertyTweener(PlatformService, 'BlurIntensity', GlobalSettings.SceneMotionBlurIntensity, 50, time, Utility.EaseInOutQuad, true)
end
wait(time)
end
function CameraManager:StopCameraMoveAsync( ... )
RunService:UnbindFromRenderStep("CameraScriptCutsceneLerp")
CameraManager:DisableCameraControl()
CameraManager:EndTransitionScreenEffect()
cameraChanged:Disconnect()
coroutine.close(TaskCoro)
warn("Corotinue Status: " .. coroutine.status(TaskCoro))
end
function CameraManager:CameraMoveToAsync( ... )
local cameraSets = {}
for k, f in pairs(workspace:WaitForChild("Cameras"):GetChildren()) do
cameraSets[f.Name] = GetCameraParts(f)
end
local first = true
TaskCoro = coroutine.create(function()
while true do
PlayAnimationAsync(cameraSets.Main, not first, false)
PlayAnimationAsync(cameraSets.Floor2, true, true)
wait(0.1)
first = false
end
end)
coroutine.resume(TaskCoro)
end
return CameraManager