Could be that I’m tired, and cannot see where I errored, but I have been trying to fix this for a while now and I give up haha
I’m working on a rich text reformatting function in a module script, since I want to use a typewriter effect for my dialogues; however there are words in the dialogue that I want to highlight a certain colour. (also if someone has a good way of doing this, please let me know! this is what I’ve come up with - )
in my module script below, I try to find a specific word in a string, which returns a number to which it starts and ends in the string. with this, I’m going to concatenate the highlighted word and continue the loop (but this is all I have so far:
local DialogueSettings = {}
DialogueSettings.DialogueColors = {
["Pink"] = "rgb(233, 107, 255)";
["Orange"] = "rgb(255, 197, 62)";
["Green"] = "rgb(103, 255, 141)";
["Red"] = "rgb(255, 73, 73)";
["Purple"] = "rgb(170, 85, 255)";
}
DialogueSettings.DialogueCharacter = {
["Becca"] = {
Cheerful = "";
Happy = "rbxassetid://11314987460";
Shocked = "";
Joyful = "";
};
["Bill"] = {
Happy = "";
Dissatisfied = "";
};
["Jessie"] = {
Cheerful = "";
Embarassed = "";
}
}
function DialogueSettings.SeparateRichText(Text,HighliteSubject,HighliteColor)
print(Text)
if string.find(Text,HighliteSubject) then
print(string.find(Text,HighliteSubject))
end
end
DialogueSettings.SeparateRichText()
return DialogueSettings
In the script, I try to call the module for testing purposes (local script):
local DialogueSettingsMod = require(script.DialogueSettings)
local DString = "Hello, Becca! How do you do?"
DialogueSettingsMod.SeparateRichText(DString,"Becca")
Resulting in the error:
meaning that in my conditional in the module script, its not receiving the string, but rather nil.
This is my hierarchy:
Any help would be amazing! thank you!