[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