I have a person you talk to claim a quest however after being in the game for a while the words appear up slower what is the reason for this?
local TextSound = Sounds:WaitForChild(“TextSound”) – store the TextSound here so you aren’t calling FindFirstChild everytime you want to display a word
local Line1 = “Help, 10 Bandits are attacking, can you help me?” – use local variables please
local Words = string.split(Line1, " ") – split the string into segments separated by spaces, returns an array
– ensure (PromptGUI.QuestInfoText.Text == “”) before doing this
for _,Word in ipairs(Words) do – ipairs should be used because pairs isn’t garuanteed to iterate over the array in order
TextSound:Play()
PromptGUI.QuestInfoText.Text …= " " … Word – compound concatentate operator
wait(0.05)
end
Hi!
Can you please explain the question more? Is this intended to create something similar to typewriter effect but with words appearing? This script can’t be the reason words start appearing slower. Does the overall game performance reduce over time? If so, maybe it has to something to do with continuous memory leaks, not enough optimized scripts etc. Here is the formated code:
local LINE1 = "Help, 10 Bandits are attacking, can you help me?"
local TYPE_SPEED = .05
local textSound = Sounds:WaitForChild("TextSound")
local words = string.split(LINE1, " ")
local infoTxt = PromptGUI.QuestInfoText
infoTxt.Text = ""
for _, word in ipairs(words) do
textSound:Play()
infoTxt.Text = infoTxt.Text .. word
wait(TYPE_SPEED)
end
Hi it could be due to memory leaks and non optimised scripts how would I check for this?
Well, you can check the Developer Console by pressing F9 when in game. You’ll find a lot of useful performance data there, including used memory at the top. Check memory usage at server start and again after a while. Do you have a lot of demanding scripts? Check Script Performance box in studio. Does your game feel smooth, or is it performance heavy?
Again, this is the next step, first check the quest system itself. When does it slow down? What part of it is slowing down? Could it be something else?
It’s hard for us to help, because there isn’t much we can do with this information.
1 Like
I think it’s client sided latency, the game is smooth if I rejoin the server the script to talk to the quest giver works fast as usual but thank you I will check if there is anything I can find.
1 Like
There are some posts around the Dev Forum adressing memory leaks. Make sure you disconnect all those connected functions that you no longer need, properly destroy parts (by not keeping them referenced somewhere else), don’t create too many parts throughout the gameplay and so on.
Does debris also work or would I need to use destroy?
Debris service destroys an instance same way :Destroy() does, but after a period of time.
1 Like