This was caused by server lag from me not debouncing a die script.
Note that a lot of this code is quite badly structured / hard to read, that’s pretty much all from the bug fixes I’ve tried to do, first thinking it was RemoteEvent firing lag, then thinking it was lag from the animate() function, which animates the text on, and a load of other stuff.
Okay so, I’ve already done a lot of testing on this, but essentially I have a for loop which times the space taken to answer the question.
local timeAmount = 17
if answerLength > 50 then
timeAmount = math.floor(((answerLength / 50)*10)/8 + 15)
end
local shown = false
for i = 1, timeAmount do
local timeLeft = timeAmount - i
spawn(function()
_G.animate(timer, timeLeft)
end)
game.Workspace.ServerValues.TimeLeft.Value = timeLeft
if timeLeft < 10 and shown == false then
shown = true
pcall(function()spawn(function()
showAnswer:FireAllClients()
end)end)
end
wait(1)
end
The global animate function changes the text on the BillboardGui, and the animation for it is fired to take place clientside. The TimeLeft value in workspace is for clientside usage, and the timeAmount is usually about 15 seconds, but the actual period of waiting ends up being about 1-2 minutes; this is obviously really annoying for gameplay, and the server script stats and server memory show little signs of overloading or lag, at the time of the timer running, it’s definitely the main consumer of memory in the game.
If anyone could give me some tips or point out a really stupid mistake I’ve made, that would be great!
[details=“Server memory and script stats screenshots”]
Bear in mind this data may be from a server that wasn’t having issues, I’m not sure.
[/details]