Objects seem to replicate perfect on Roblox Studio local server but will not inconsistently in game

I’ve been trying to solve a bug that will inconsistently appear in my game but will under no circumstance occur on my test or local server. I’ve identified the portion in my code responsible, which was EXTREMELY difficult because the only thing I could do was to use gui text to display when a portion of my local code crashed.

My Code Explained:
My game uses a custom toolbar that clones “Ability” objects with remoteevents that will trigger a unique power. The issue I have is that the remoteevent instance of each “Ability” will sometimes not replicate when playing the game causing the player’s local script to crash BUT will ALWAYS replicate just fine on my local server.

local powerEventA = powerupA:WaitForChild("RemoteEvent")

This piece of code is responsible for the replication issue. I have also tried using FindFirstChild but the issue still persists. I am really not sure why my “Ability” instance is replicating 100% fine on my local server but not in game… Any help would be appreciated, otherwise I believe this may be an issue with Roblox’s Servers

If you have your events in replicated storage they will replicate automatically.

How are you inserting the events into powerupA?

I havent really explained my code very well. I am storing my PowerupA instance in replicated storage, but then im cloning it to the player’s backpack when the character spawns. The server replicates this perfectly to the client when testing locally and MOST of the time in the actual game servers. Its the server to client replication on roblox servers that will SOMETIMES not execute

That’s because you’re connected to your own internet in Studio, and in game you’re connected to Roblox, resulting in a much higher ping which may or may not cause this problem.

I don’t see a reason to clone them to the players backpack. Just access them directly from ReplicatedStorage and you won’t have the issue anymore.

1 Like

That would be a reasonable idea, however I have a debounce function that would make more than one player using the same ability impossible, I would call debounce from the client script instead but it causes way too much lag. I played the game a lot today on a different wifi connection and not encounter the bug a single time.