Hey there, my name is ShieldDevs, you can call me Shield.
So lately I’ve been trying to use Defaultio’s Rich Text Module because of its text animations and many other options.
After trying to use it, I stumbled upon this problem, which I have no idea how to fix.
The problem is that everytime I try to use it, the function only runs once, and then breaks the Remote Event it’s inside. Here are the scripts.:
Server Script (fires everytime it’s triggered)
script.Parent.Triggered:Connect(function(player)
game.ReplicatedStorage.RichTextActivitaor:FireClient(player)
print("fired")
end)
Client Script (where the problem is)
local richText = require(script.Parent.Parent.Parent.Parent:FindFirstChild("RichText"))
script.Parent.Parent.Parent.Enabled = true
local text = script.Parent
local MainFrame = script.Parent.Parent
local tweenService = game:GetService("TweenService")
local frameFadeIn = tweenService:Create(text, TweenInfo.new(1), {BackgroundTransparency = 0.7})
local frameFadeOut = tweenService:Create(text, TweenInfo.new(1), {BackgroundTransparency = 1})
local textSequence = {"<TextScaled=false><AnimateStyle=FallDown><AnimateYield=1>What do you want?<AnimateStyle=/><TextScaled=/>", "<TextScaled=false><AnimateStyle=FallDown><AnimateYield=1>What brought you here?<AnimateStyle=/><TextScaled=/>", "<TextScaled=false><AnimateStyle=FallDown><AnimateYield=1>Why do you want to leave the city?<AnimateStyle=/><TextScaled=/>", "<TextScaled=false><AnimateStyle=FallDown><AnimateYield=1>What's your name?<AnimateStyle=/><TextScaled=/>"}
local OnGoingDialogue = false
local function StartDialogue()
if OnGoingDialogue then
return
end
OnGoingDialogue = true
frameFadeIn:Play()
local RandomText = textSequence[math.random(1, #textSequence)]
print(RandomText)
local textObject = richText:New(text, RandomText, {Font = "Fantasy"}, {ContainerVerticalAlignment = "Top"})--, AnimateStyle = "Wiggle", AnimateStepFrequency = 1, AnimateStyleTime = 7, AnimateStyleNumPeriods = 10})
textObject:Animate(true)
wait(5)
frameFadeOut:Play()
textObject:Hide()
OnGoingDialogue = false
print(OnGoingDialogue)
end
game.ReplicatedStorage.RichTextActivitaor.OnClientEvent:Connect(function()
print("got it")
StartDialogue()
end)
On the client script, it receives the order from the server script, runs the function, and then doesn’t run anymore. Removing the StartDialogue() from the ClientEvent function fixed the problem, but now I can’t run the StartDialogue() function.
I have no idea how to fix this, so your help would be greatly appreciated!
Thanks,
Shield