Camera animation failing to trigger when PlayerAdded, help is appreciated!

I’m quite embarrassed to admit that I need some help after previously getting help from people.

Context: I’m attempting to create a cutscene that triggers when a player joins the game.

Script:


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.TEST_Camera.Frames -- Path to your folder! 

	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
Game.Players.PlayerAdded:Connect(Cinematic)
	end)
end

Disclaimer: This is not my script. I’ve only written parts to call the function and the path to my folder. The original creator of the script is linked here.

I’ve also looked at the Script output and found nothing relating to the actual script, leading me to think that I messed up with calling the function.

If anyone could point out, or potentially fix what is wrong with this script, it’ll be greatly appreciated.

Thanks!

I don’t know if this will make your script work, but change the capital Game to a lowercase game.

Edit: also do this for the Game at the bottom where you connect the function:

Unfortunately, that doesn’t work. Any other solutions?

Yes, also move that connect function to the very end.

Your script should be showing you red error lines… right?

Also, let us know what errors the output window shows in red, not the script analysis.

Somehow no, there are no red lines in the script, and there’s no errors with the output. It simply just doesn’t activate or function at all

Try Codes Otaku Cutscene plugin… has a link to a YT video that explains how to use it.

The thing with Codes Otaku Cutscene plugin is that its very limited compared to Moon Animator. Hopefully I can find a fix on this. Is there anything else that you see potentially wrong with this script? I’ve seen several games (Such as Entry Point) use cutscenes with moon animator. And apparently the script works for everyone else BUT myself.

Is it a local script or server script?

It’s a local script in StarterPlayerScripts

My guess is that the Game.Players.PlayerAdded:Connect(Cinematic) is inside the function, which is why it wont work.

Try putting it outside the function.

i already suggested this to him:

Ok you cant access serverstorage from a local script… move the folder in there to ReplicatedStorage and change your reference in the script to that location:

Still doesn’t work. As of now, it’s 10 PM, and I have to go. I’ll check on this topic when I’m available. Thanks for your dedication to fix my problem!

1 Like

And I assume your folder and its contents are labeled like this:

ReplicatedStorage > MoonAnimatorExports > TEST_Camera > Frames

Here is the updated code:

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.ReplicatedStorage.MoonAnimatorExports.TEST_Camera.Frames -- Changed 'ServerStorage' to 'ReplicatedStorage'

	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

game.Players.PlayerAdded:Connect(Cinematic) -- Moved PlayerAdded Event outside the function, which should make everything function now.

He already replied that this didn’t work for him.

That means something must be erroring, wait for the OP to come back and post the error if there is one.

He already replied that… follow the thread from the start please.

He must have misplaced or done something wrong then.

1 Like

We will have to wait for him to repost his most recent script to re-check it again.