Hello!
So, I’m writing about the same topic twice, I realized I didn’t follow the forum topic layout.
-
What do you want to achieve? I’m trying to trigger moon animator camera movement in-game using a script.
-
What seems to be the issue?
Unfortunately, none of the scripts I’ve tried really work. My rig animations work great, it’s only the camera that causes a problem. -
What solutions have you tried so far?
Since I have little to no experience when it comes to camera manipulation, the first thing I did was check on the dev forum about how to do this. I quickly came across a script that apparently does just what I’m asking for:
local RunService = game:GetService("RunService")
local Character = game.Players.LocalPlayer.Character or game.Players.LocalPlayer.CharacterAdded:Wait()
local Camera = workspace.Camera
function Cinematic()
local CinematicsFolder = game.Serverstorage.MoonAnimatorExports.Cutsceneanim.cutsceneanimcamera.frames -- (This is my actual frames folder, so that isn’t the problem.)
local CurrentCameraCFrame = workspace.CurrentCamera.CFrame
Camera.CameraType = Enum.CameraType.Scriptable
local FrameTime = 0
local Connection
Connection = RunService.RenderStepped:Connect(function(DT)
local NewDT = DT * 60
FrameTime += NewDT
local NeededFrame = CinematicsFolder.Frames:FindFirstChild(tonumber(math.ceil(FrameTime)))
if NeededFrame then
Character.Humanoid.AutoRotate = false
Camera.CFrame = NeededFrame.Value
else
Connection:Disconnect()
Character.Humanoid.AutoRotate = true
Camera.CameraType = Enum.CameraType.Custom
Camera.CFrame = CurrentCameraCFrame
end
end)
end
When I tried running it in-game, nothing happened other than me expecting something to happen.
Could anyone explain to me why this script isn’t doing as intended? Thanks.