Please can someone tell me what is wrong with this script? :( Thank you.
function onClick() wait(2) repeat wait () until game.Workspace.CurrentCamera ~= nil local c = game.Workspace.CurrentCamera local data = LoadLibrary("RbxUtility").DecodeJSON('[{"FOV":70,"Roll":0,"c1":[249.0168762207,12.263187408447,-595.06884765625,0.99963241815567,5.2330924518174e-005,-0.027112856507301,3.6379788070917e-012,0.99999821186066,0.0019301113206893,0.02711290679872,-0.0019294018857181,0.99963057041168],"step":2.5,"f1":[249.42356872559,12.23423576355,-610.06329345703,1,0,0,0,1,0,0,0,1]},{"FOV":70,"Roll":0,"c1":[249.84315490723,18.776773452759,-660.60375976563,0.99998062849045,-0.00083417579298839,-0.0061798207461834,-5.8207667852361e-011,0.99101239442825,-0.13377061486244,0.0062358677387238,0.13376802206039,0.9909930229187],"step":2.5,"f1":[249.93585205078,20.783332824707,-675.46862792969,1,0,0,0,1,0,0,0,1]}]') function tweenCam(c1,f1,time,fov,roll) local c0,f0,fv0,r0,frames = c.CoordinateFrame,c.Focus,c.FieldOfView,c:GetRoll(),time/0.03 for i = 1,frames do c.CameraType = "Scriptable" c.CoordinateFrame = CFrame.new(c0.p:lerp(c1.p,i/frames),f0.p:lerp(f1.p,i/frames)) c.FieldOfView = (fv0+(fov-fv0)*(i*(1/frames))) c:SetRoll(r0+(roll-r0)*(i*(1/frames))) wait() end end print("Running") c.CameraSubject = nil c.CameraType = "Scriptable" c.CoordinateFrame = CFrame.new(unpack(data[1].c1)) c.Focus = CFrame.new(unpack(data[1].f1)) c.FieldOfView = data[1].FOV c:SetRoll(data[1].Roll) if script:findFirstChild("SkipCutsceneGuiValue") then local gui = script.SkipCutsceneGui:clone() gui.Parent = game.Players.LocalPlayer.PlayerGui gui.Cutscene.Value = script gui.Main.Debug.Disabled = false script.SkipCutsceneGuiValue.Value = gui end for i = 2,#data do tweenCam(CFrame.new(unpack(data[i].c1)),CFrame.new(unpack(data[i].f1)),data[i].step,data[i].FOV,data[i].Roll) end c.CameraSubject = game.Players.LocalPlayer.Character.Humanoid c.CameraType = "Custom" c.FieldOfView = 70 if script:findFirstChild("SkipCutsceneGuiValue") then if script.SkipCutsceneGuiValue.Value ~= nil then script.SkipCutsceneGuiValue.Value:Destroy() end end script:Destroy() script.Parent.ClickDetector.MouseClick:connect(onClick) end
Try moving line 47 to line 49, because I think that the function would never run if it stayed there.