You can write your topic however you want, but you need to answer these questions:
What do you want to achieve? To use FireClient but I need to get the player, but once I get the player it doesnt work.
What is the issue? I am making a boss fighting game, with a gui that says things once he spawns in, but when there are multiple players it runs multiple times because im using fireallclients, but once I use fireclients it doesnt work.
What solutions have you tried so far? Ive looked it up in multiple ways.
My script just checks if the boss fight is active, then it fires it but once I use fireclient it doesnt work.
The code is correct so there’s nothing wrong with that, it’s likely something else in the script that’s causing it. It’s impossible to say exactly what may be the cause without more of the code.
The server is sending the message to the client before the client’s script has loaded. It’s firing correctly, but the local script hasn’t loaded and thus can’t receive the remote event connection.
Wait, I should of loaded, because I am making a round based game and it only fires once the round starts, and the lobby timer is 10 seconds. I got the remote event by using wait for child too.
I’m still a bit unclear about the details, but I’ll do my best to propose a solution. It sounds like you want a way for the server to communicate to the clients the current state of the boss fight. I saw your remote event was called “start”.
If you just need to track a state, you may just want to have a bool variable in Workspace called “BossFightStarted” or something like that, and just check it and uncheck it based on if there’s an active boss fight or not.
On the client side, you just have the player GUI check the state of that bool variable to see if it’s true or not, indicating whether there is a boss fight going on or not. And once you figure that out, you should then have the GUI listen for the .Changed event for when the server toggles it to true or false.
This is my preferred method for game states because it’s easy to maintain the code for the client regardless of if they join before or during an in-game event/state. Plus, Roblox’s client replicator handles everything for you and you don’t need to use any remote events, so your code will be very simple and concise.
I only suggest this method for data whose information does not change frequently, or else it could cause higher network usage.
———————————-
If you want to use remote events, you need to separate what happens when a player is in the game before the event switch and after the event switch. For example, let’s say you have two players. One player joins before the boss fight starts, and another player joins after the boss fight starts. Suppose you play a cutscene at the start of the boss fight. You want the player there at the start to see it, but not the player who joined halfway through the fight. To do this, you would:
When the boss fight starts, send a remote event that triggers everything for when the scene starts. You can use call FireAllClients once in one script, or FireClient once for each player.
When someone joins mid-fight, they need to know the current game state from the remote event triggered by the player added event, which needs to be a separate event from what I mentioned in 1. if the functionality would be different.
Ok great! Glad I could help! It’s just something you learn from experience. I only thought of it because I made a game using remote events to track state and found a bunch of bugs down the road that were tedious to fix, and I found the first method much easier to use.