Hi, I'm having trouble with this Bezier CFrame script. For some reason, the script is not working in game, but working in studio. Here's this script:
local pointsModel = workspace.Points:GetChildren() -- this is a model with all the points we want to -- interpolate through. They are named in numeric order (1, 2, 3, 4 ,etc) local pointsTable = {} -- we are going to create a table to store the points. for k,v in pairs(pointsModel) do -- loop through the model table.insert(pointsTable,v.CFrame) -- add the CFrame to the table end local BezierModule = require(workspace.BezierCFrame) -- I shouldn't have to tell you what this means. -- this next little bit is a cool trick I use to make perfect timing and smooth interpolations -- I'll tell you when things start getting relevant to the READ ME. local runService = game:GetService("RunService") -- access run service local duration = 5 -- duration of the camera interpolation in seconds local start = tick() -- we can use this to find out how much time has passed runService:BindToRenderStep("BezierCamera",Enum.RenderPriority.Camera.Value, function() -- we do this to make the function run every frame, creating a smooth interpolation, -- This is where things start to be relevant local elapsedTime = tick() - start -- find out how much time has passed local ratio = elapsedTime/duration -- our Zero through One number if elapsedTime >= duration then runService:UnbindFromRenderStep("BezierCamera") -- disconnect the function else local cf = BezierModule:getCF(pointsTable, ratio) -- gets the CFrame based on the points and ratio. Simple as that. workspace.CurrentCamera.CoordinateFrame = cf -- sets the CFrame on the camera. workspace.CurrentCamera.Focus = cf * CFrame.new(0,0,-1) -- makes the camera look forward workspace.CurrentCamera.CameraType = Enum.CameraType.Scriptable end end)
Are there any ways this is fixable?
Thanks! ;)