Hi, I’ve been getting a very strange bug that I can’t seem to find anywhere on the internet? (i think i looked hard enough)
But for some reason, my code just breaks every time the game gets alot of players (it doesnt look like a coincidence)
So I have a “reserve server” teleport in my game that fires when Onclientevent and it seems to work fine the whole day with 4K+ CCU then i notice that every time the game starts gaining 6-8K, the players just dip instantly and the game falls down to 1-2K CCU within 5 minutes and loads of bug reports about the game not teleporting them.
It seems like more than half of players get the issue but the other half don’t, including me.
I’ve tried hopping to every server while the bug was ongoing but I could not replicate it myself.
Shutting down servers seems to fix the problem but I obviously don’t want to do that everyday, and sometimes the bug just fixes itself after an hour, while I’m asleep and not on studio.
I’ll show the client and server code for the teleport and if there’s anything very wrong with the code, please let me know!
CLIENT:
Singleplayer.MouseButton1Click:Connect(function()
RS.Singleplayer:FireServer()
task.wait(20)
--CODE HERE THAT TELLS PPL TO SAY "BUG #1" in group wallgroupwall."
end)
SERVER:
TPS.TeleportInitFailed:Connect(function(plr,result,errormsg)
warn(result,errormsg)
--CODE HERE THAT TELLS PPL TO SAY "BUG #6" in group wall
end)
function reserveServerWithRetry(placeId, retries, plr) --this makes the teleport retry 6 times if accesscode fails
local success, accessCode
for i = 1, retries do
success, accessCode = pcall(TPS.ReserveServer, TPS, placeId)
if success then return accessCode --CODE HERE THAT TELLS PPL TO SAY "BUG #5.5" in group wall
else warn(accessCode)
end
warn("Retrying ReserveServer: Attempt " .. i)
task.wait(2)
end
--CODE HERE THAT TELLS PPL TO SAY "BUG #5" in group wall
error("Failed to reserve server after " .. retries .. " attempts.")
end
RS.Singleplayer.OnServerEvent:Connect(function(plr)
if not plr or not plr.Parent then
warn("Player not available.")
--CODE HERE THAT TELLS PPL TO SAY "BUG #4" in group wall
return
end
local success, output = pcall(function()
local Access = reserveServerWithRetry(PlaceId, 6, plr)
if Access then
TPS:TeleportToPrivateServer(PlaceId, Access, {plr})
else
--CODE HERE THAT TELLS PPL TO SAY "BUG #3" in group wall
error("Failed to reserve server.")
end
end)
if not success then
warn("Teleport failed: " .. output)
--CODE HERE THAT TELLS PPL TO SAY "BUG #2" in group wall
end
Whenever the game breaks, I ONLY get people saying “bug #1” and nothing else so I was starting to think that it could be about the RemoteEvents?
I’ve also been getting these errors in error report and I’m not sure if this really has anything to do with my problem.