Multiple connections to the same event in different Actors causes the event to not fire when solo play testing in Studio

Problem

When multiple connections to the same event are made within different actors, the events either do not fire reliably or they do not fire at all. An example of such an event is Players.PlayerAdded. As in the test file below, there are 20 identical actors with identical scripts which demonstrates the problem as a hard failure in solo play test mode. The only difference in the actors are the names. With this setup, the event does not fire at all for any actor. There are no errors when this occurs. Additionally, even script errors are not reported.

Additional Information

I noticed this last night (9 November 2023) as some typos were not being flagged unless I was play testing on the local server. I usually play test solo, so I’m not sure how long this issue has been around. What’s interesting though is that the live server for my actual game never flagged an error on the script typos either. However, with the Bug Demonstration place that I created, it was working correctly, so the results of this happening on a live server are mixed, may be an intermittent occurrence.

Field Value
Problem Area Studio
Component Solo Play Testing (Possible Engine as well)
Script Feature Parallel LUA
First Noticed 09 November 2023
Frequency Constant
Severity High
Imact Possibly game breaking if confirmed on Engine.
CPU AMD FX-8350 8-Core x64 4.00 GHz
RAM 16.0 GB
Video AMD Radeo RX 6500 XT

Visuals

The shared table shows all actors at 6 and the messages that are supposed to print do not print at all while using solo play.

From the local test server instance showing what the output is supposed to look like.

Reproduction

  1. Load the attached file into Studio.
  2. Start solo play session and note the results.
  3. Start a local test server and not the results.
  4. Observe the differences between the results obtained in steps 2 and 3.

Materials

Test Place File
Studio - Actor Event Connections.rbxl (56.6 KB)

Bug Demonstration Place (Live Server)
ID: 15311253782

The Proving Grounds - Live Test Server
ID: 15112688736
NOTE: You will need to join the group to access the server.

Expected behavior

What I expect to happen is that all connections are executed when the event fires.

In solo play, Player connects immediately after server launch.
Which means that you don’t have that much time to setup your connections and you have multiple task.wait calls performed before reaching stage 5 in your actors.

You can see it by setting up PlayerAdded connection at the start of the script:

playerService.PlayerAdded:Connect(function(player)
	print(`Root: {player.Name}`)
end)

-- Wait for all actors to execute their main scripts and
-- to reach their stopping points.
task.wait(1)

-- Initialize Server
checkActors()
sendTables()
setActorStage(1)

It will report a player being added before actors are configured.

1 Like

Good to know. That also explains why it seems to be intermittent on the live server too.

I was thinking it was a race condition that was along those lines, so I developed a workaround for it. Basically, in the ServerStartup script, I added the event handler for Players.PlayerAdded so it’s connected before the main startup begins. Any players that connect in the mean time are held by the polling wait loop until that flag becomes true. Once that happens, a PlayerAdded message is sent to all actors so they can do what they need to when a player connects.

Updated version with the new code.
Studio - Actor Event Connections.rbxl (56.9 KB)

The workaround fixes the issue.

Thank you for responding and explaining what was going on.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.