Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why doesn't this music play immediatly?

Asked by 10 years ago
01repeat wait () until game.Workspace.CurrentCamera ~= nil
02game.Workspace.Sound:Play(143299986)
03 
04local c = game.Workspace.CurrentCamera
05local data = LoadLibrary("RbxUtility").DecodeJSON(script.CutsceneData.Value)
06local rs = game:GetService("RunService").RenderStepped
07 
08function tweenCam(c1,f1,time,fov,roll)
09    local c0,f0,fv0,r0,frames = c.CoordinateFrame,c.Focus,c.FieldOfView,c:GetRoll(),time/0.015
10    for i = 1,frames do
11        c.CameraType = "Scriptable"
12        c.CoordinateFrame = CFrame.new(c0.p:lerp(c1.p,i/frames),f0.p:lerp(f1.p,i/frames))
13        c.FieldOfView = (fv0+(fov-fv0)*(i*(1/frames)))
14        c:SetRoll(r0+(roll-r0)*(i*(1/frames)))
15        rs:wait()
View all 45 lines...

Hey, I'm making a cutscene with sound, and when I put in this script (including cutscene script) The music plays after like 20 seconds, almost when the cutscene is over.

Answer this question