From 4ae0dd250f7959fd388124f9c71aa7c319760160 Mon Sep 17 00:00:00 2001 From: Wanderer <122536026+nukemaster619@users.noreply.github.com> Date: Tue, 27 Aug 2024 02:37:14 +0800 Subject: [PATCH] Fix missing elements, add gui elements and string interpolation I noticed that when calling for :GetElements(), it returns an empty table, leaving me unable to modify any elements such as rigs to be replaced by a clone of the player's character. I fixed that and modified the path for MoonAnimator's CoreGui, leading to ReplicatedStorage instead. There, you just have to make a ScreenGui with similarly named elements and parent the ScreenGui to the PlayerGui before playing the cutscene in order to make it work (with the exception of the Letter Box). I also added String interpolation for the Subtitles to work. --- Moonlite/init.lua | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/Moonlite/init.lua b/Moonlite/init.lua index a3b23dc..b6db250 100644 --- a/Moonlite/init.lua +++ b/Moonlite/init.lua @@ -110,6 +110,13 @@ local function resolveAnimPath(path: MoonAnimPath?, root: Instance?): Instance? local name = path.InstanceNames[i] local class = path.InstanceTypes[i] + if name == "CoreGui" then + path.InstanceNames[i] = "ReplicatedStorage" + path.InstanceTypes[i] = "ReplicatedStorage" + name = path.InstanceNames[i] + class = path.InstanceTypes[i] + end + local nextInst = (current :: any)[name] assert(typeof(nextInst) == "Instance") assert(nextInst.ClassName == class) @@ -571,6 +578,12 @@ local function getInterpolator(value: any): (start: any, goal: any, delta: numbe local value = lerp(start.Min, goal.Min, t) return NumberRange.new(value) end + elseif typeof(value) == "string" then + return function(start: string, goal: string, t: number) + local interpolatedString = goal:sub(1, math.floor(t * #goal)) + local remainingString = start:sub(math.floor(t * #goal) + 1) + return interpolatedString..remainingString + end elseif CONSTANT_INTERPS[typeof(value)] then return function(start: any, goal: any, t: number) if t >= 1 then @@ -586,10 +599,12 @@ end local function compileFrames(self: MoonTrack, targets: MoonTarget) local buffer = self._buffer + local elements = self._elements for target, element in targets do local frames = {} buffer[target] = frames + table.insert(elements, target) for name, value in element.Props do if not value.Sequence[1] then