[V2] Moon2Cutscene | Play Moon Animator 2 Files

ok that makes sense! Thanks :+1:

I also have one problem. Iā€™m trying to access the moonsave I have called Briefing. Itā€™s saying Moon2Cutscene is not a valid member of ServerStorage ā€œServerStorageā€ How do I fix this? Iā€™ve kept my Module script in Server Storage and Iā€™ve made a server sided script for a Remote event.

Server:

local moon2Cutscene = require(game.ServerStorage.Moon2Cutscene) -- replace with actual path
local file = game.ServerStorage.MoonAnimator2Saves.Briefing

-- RemoteEvent to trigger cutscene for the player
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local cutsceneEvent = Instance.new("RemoteEvent")
cutsceneEvent.Name = "CutsceneEvent"
cutsceneEvent.Parent = ReplicatedStorage

-- Trigger cutscene for player (e.g., when the player joins or on some event)
game.Players.PlayerAdded:Connect(function(player)
	-- Fire the event to the client for cutscene play
	cutsceneEvent:FireClient(player)
end)

Local:

-- StarterPlayerScripts/PlayCutscene.lua
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local cutsceneEvent = ReplicatedStorage:WaitForChild("CutsceneEvent")

local moon2Cutscene = require(game.ServerStorage.Moon2Cutscene) -- replace with actual path
local file = game.ServerStorage.MoonAnimator2Saves.Briefing

cutsceneEvent.OnClientEvent:Connect(function()
	-- Create the cutscene on the client
	local newCutscene = moon2Cutscene.new(file)

	-- Replace the playerā€™s character in the cutscene (optional)
	local player = game.Players.LocalPlayer
	local character = player.Character or player.CharacterAdded:Wait()
	character:PivotTo(CFrame.new(0, 5, 0)) -- Example starting position
	newCutscene:replace(1, character)

	-- Ensure all objects are ready
	local canFind, objectMissing = newCutscene:canFindObjects()
	if not canFind then
		warn("Missing object: ", objectMissing)
	end
	newCutscene:waitForObjects()

	-- Play the cutscene
	newCutscene:play()

	-- Optional: Add effects like vignette or fade
	local fade = moon2Cutscene.Fade(1, 2, 1, Color3.fromRGB(0, 0, 0))
	fade()
end)

I would just want to be able to like play it whenever the remote event is fired. With text playing and all sorts of effects given. Would I also add a folder including all my things (the building and the characters) and put it in Rep Storage, then accessing it with a .new()? Iā€™m not sure how that works, as Iā€™m a bit confused now. Iā€™m new to coding and all, thatā€™s why Iā€™m revising and asking many questions. Sorry!

You canā€™t access server storage nor server script service children on the client, hence the name ā€œserverā€ You can make a copy in replicated storage

how do I call the objects?

Missing object:   {
                    ["Path"] =  {
                       ["InstanceNames"] =  {
                          [1] = "game",
                          [2] = "Workspace",
                          [3] = "Reggie"
                       },
                       ["InstanceTypes"] =  {
                          [1] = "DataModel",
                          [2] = "Workspace",
                          [3] = "Model"
                       },
                       ["ItemType"] = "Rig"
                    }
                 }  -  Client - LocalScript:22

I dont know what you mean by call, but i suppose you mean that your cutscene isnā€™t loading.
This is caused due to the objects not being there on the client.
What you can do is

  1. put every object into a folder
  2. whenever you create the cutscene, add a refrence to the folder,
local map = path.to.folder -- you can put it somewhere close to the file
local newCutscene = moon2Cutscene.new(file, map)

If that still doesnt work, for example some objects are missing you can manually replace them

how would I go about manually replacing them. It didnā€™t work.

is this the code

newCutscene:replace(1, character) -- replace the appropiate index with the player's character

nor do I understand what this means

Missing object:   ā–¼  {
                    ["Path"] =  ā–¼  {
                       ["InstanceNames"] =  ā–¼  {
                          [1] = "game",
                          [2] = "Workspace",
                          [3] = "Matt Graver"
                       },
                       ["InstanceTypes"] =  ā–¼  {
                          [1] = "DataModel",
                          [2] = "Workspace",
                          [3] = "Model"
                       },
                       ["ItemType"] = "Rig"

my folder called Cutscene containing the map and the characters is in Replicated Storage btw.

But wait, how do i know which indexā€™s which?

  • You can use this snippet to easily find which index to replace:
for i,v in file.file.Items do
	local path = "game"
	for i, n in v.Path.InstanceNames do
	if i == 1 then continue end
		path ..= "."..n
	end

	print(`[{i}] {path}`)
end

Now, you want to ensure every object can be found via

newCutscene:waitForObjects()

My cutscene doesnā€™t play after adding this!

  • You have objects that canā€™t be found! Use the newCutscene:canFindObjects() method to debug:
local canFind, objectMissing = newCutscene:canFindObjecs()
if not canFind then
warn(objectMissing)
end

Perhaps you have an effect track? They must be manually created (atleast for now).
But fear not! This module got you covered, simply create a task and use the moon2Cutscene.subtitle(Text:string, properties:{}?) function! Iā€™m mainly confused on this portion.

-- Services
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local ServerStorage = game:GetService("ServerStorage")
local CutsceneEvent = ReplicatedStorage:WaitForChild("CutsceneEvent")

local player = game.Players.LocalPlayer

-- Optional: Replace objects with dynamic ones (e.g., player character)
local character = player.Character

-- MoonAnimator2 Module
local moon2Cutscene = require(ReplicatedStorage:WaitForChild("Moon2Cutscene"))

-- Cutscene File and Map (folder with objects)
local file = ReplicatedStorage.Briefing -- Cutscene file
local mapClone = nil -- Placeholder for the cloned map

-- Function to play the cutscene
local function playCutscene(player)
	-- Clone the cutscene folder from ReplicatedStorage to Workspace
	if not mapClone then
		local map = ReplicatedStorage:WaitForChild("Cutscene") -- Folder containing the cutscene objects in ReplicatedStorage
		mapClone = map:Clone() -- Clone it
		mapClone.Parent = workspace -- Set the parent to Workspace
	end

	-- Create the new cutscene instance using the file and the cloned map
	local newCutscene = moon2Cutscene.new(file, mapClone)
	newCutscene:replace()

	
	if character then
		-- Pivot the player to the start CFrame if needed
		-- Replace the first object in the cutscene with the player's character
		newCutscene:replace(1, character)
	end

	-- Ensure all objects are ready
	local canFind, objectMissing = newCutscene:canFindObjects()
	if not canFind then
		warn("Missing object: ", objectMissing)
	end

	-- Wait for all objects to be loaded properly
	newCutscene:waitForObjects()

	-- Play the cutscene
	newCutscene:play()

	-- Optional: Add effects like fade or vignette if desired	
	local fade = moon2Cutscene.Fade(1, 2, 1)
	fade()
end

-- Event Listener for triggering the cutscene
CutsceneEvent.OnClientEvent:Connect(function(player)
	playCutscene(player)
end)

-- Ensure the script knows the cutscene system is ready
print("Cutscene system initialized.")

on how I would add that to this

put this inside your code

local newCutscene = moon2Cutscene.new(file)
for i,v in newCutscene.file.Items do
	local path = "game"
	for i, n in v.Path.InstanceNames do
	if i == 1 then continue end
		path ..= "."..n
	end

	print(`[{i}] {path}`)
end

press run and it should print what index is what object, find your desired one and then replace it

-- Services
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local ServerStorage = game:GetService("ServerStorage")
local CutsceneEvent = ReplicatedStorage:WaitForChild("CutsceneEvent")

local player = game.Players.LocalPlayer

-- Optional: Replace objects with dynamic ones (e.g., player character)
local character = player.Character

-- MoonAnimator2 Module
local moon2Cutscene = require(ReplicatedStorage:WaitForChild("Moon2Cutscene"))

-- Cutscene File and Map (folder with objects)
local file = ReplicatedStorage.Briefing -- Cutscene file
local mapClone = nil -- Placeholder for the cloned map

-- Function to play the cutscene
local function playCutscene(player)
	-- Clone the cutscene folder from ReplicatedStorage to Workspace
	if not mapClone then
		local map = ReplicatedStorage:WaitForChild("Cutscene") -- Folder containing the cutscene objects in ReplicatedStorage
		mapClone = map:Clone() -- Clone it
		mapClone.Parent = workspace -- Set the parent to Workspace
	end

	-- Create the new cutscene instance using the file and the cloned map
	local newCutscene = moon2Cutscene.new(file, mapClone)
	
	local newCutscene = moon2Cutscene.new(file)
	for i,v in newCutscene.file.Items do
		local path = "game"
		for i, n in v.Path.InstanceNames do
			if i == 1 then continue end
			path ..= "."..n
		end

		print(`[{i}] {path}`)
	end
	
	newCutscene:replace(1, game.Workspace.Cutscene.Reggie)
	newCutscene:replace(2, game.Workspace.Cutscene.Kate)
	newCutscene:replace(3, game.Workspace.Cutscene:FindFirstChild("Matt Graver"))
	newCutscene:replace(4, game.Workspace.Cutscene.MissionMan)
	newCutscene:replace(5, game.Workspace.Cutscene.Random)
	newCutscene:replace(6, game.Workspace.CurrentCamera)
	newCutscene:replace(7, game.Workspace.Cutscene.Reggie.Head.Mouth.face2)
	newCutscene:replace(8, game.Workspace.Cutscene.Reggie.Head.Eyes.face)
	newCutscene:replace(9, game.Workspace.Cutscene.Kate.Head.Eyes.face)
	newCutscene:replace(10, game.Workspace.Cutscene.Kate.Head.Mouth.face2)
	newCutscene:replace(11, game.Workspace.Cutscene.Random.Head.Eyes.face)
	newCutscene:replace(12, game.Workspace.Cutscene.Random.Head.Mouth.face2)
	newCutscene:replace(13, game.Workspace.Cutscene.MissionMan.Head.Eyes.face)
	newCutscene:replace(14, game.Workspace.Cutscene.MissionMan.Head.Mouth.face2)
	newCutscene:replace(15, game.Workspace.Cutscene.MattGraver.Head.Eyes.face)
	newCutscene:replace(16, game.Workspace.Cutscene.MattGraver.Head.Mouth.face2)



	
	if character then
		-- Pivot the player to the start CFrame if needed
		-- Replace the first object in the cutscene with the player's character
		newCutscene:replace(1, character)
	end

	-- Ensure all objects are ready
	local canFind, objectMissing = newCutscene:canFindObjects()
	if not canFind then
		warn("Missing object: ", objectMissing)
	end

	-- Wait for all objects to be loaded properly
	newCutscene:waitForObjects()

	-- Play the cutscene
	newCutscene:play()

	-- Optional: Add effects like fade or vignette if desired	F
	local fade = moon2Cutscene.Fade(1, 2, 1)
	fade()
end

-- Event Listener for triggering the cutscene
CutsceneEvent.OnClientEvent:Connect(function(player)
	playCutscene(player)
end)

-- Ensure the script knows the cutscene system is ready
print("Cutscene system initialized.")

Iā€™m still getting the same Warning not error

  10:12:40.655  Missing object:   {
                    ["Path"] =  {
                       ["InstanceNames"] =  {
                          [1] = "game",
                          [2] = "Workspace",
                          [3] = "Reggie"
                       },
                       ["InstanceTypes"] =  {
                          [1] = "DataModel",
                          [2] = "Workspace",
                          [3] = "Model"
                       },
                       ["ItemType"] = "Rig"
                    }
                 }  -  Client - LocalScript:70

^
| Thatā€™s the warning Iā€™m getting yet I dont know how to fix it even though I specified it in the local script I have

Would you mind saving your place to a file and sending it?

1 Like

Mission1Test.rbxl (146.6 KB)

here you go.

Mission1Test.rbxl (133.1 KB)
Here you go, the cutscene runs now.

1 Like

oh my god. Wow this is crazy good. Thanks a ton!

1 Like

for effects, would I have to add them within the script or within the moonAnimation I am creating?

like i said before; i published an update adding the bars you suggested and automatically handling the effects so you need only make them in moon animator

1 Like

alright, thanks for the clarifications. I really appreciate it. (Sorry again for many questions)

another question lol mb, is there support for audio? Would I do the same thing for what I did with subtitles by calling the frame and then saying audio:Play()

I also have another question SORRY! so I had a cutscene this time including an object. I did everything everything plays, however only the humanoids move rather than the object I had which was a plane.