FireAllClients() Only firing once in a loop

I can seem to figure this out, this is all under a while true do script and no matter how I write it I always get the same problem.

When I fire all clients it only works on the first loop, but when it goes to replay the game and gets down to RT == 0 it changes all the values to everything and prints everything doesn’t print any errors but doesn’t replay the FireAllClients… please help… this is my main loop needed for my game…

I added a wait for activated games so the whole true do script only plays when activated games is true thinking I was just exhausting the scripts but still no solution.

2 Likes

are you setting the RT value back to 0 at all?

1 Like

Yeah at the top of the loop when I Fire (start) I bring the round time back up too 120 then the round time counts back down to 0 when it hits 0 it prints everything correctly and acts like it’s working but for some reason will on fire the “End” event once.

maybe add some more print checkpoints, one right before and after the end event firing. Maybe one in the local script where the event is firing. Print checkpoints will help find where the issue is

I will try adding some prints in the fire event itself, because i have a round is over print right before I fire end which is going off so let me try

ok! let me know if you find the issue, if not I’ll try to think of something

1 Like

So this is the Scrip that the END event is firing,

So on the first loop everything works and prints correctly with the added prints

Then on the second loop it will only print the first print which is “End Fired”.

It stops at the while game.Replicated. Blah blah blah. == true do…

Even though if I’m checking the value in game the value is true at the time that is firing, so I’m not sure what’s stopping this check.

image

if you were to change RT.Value == into RT.Value <= it would work, in the code after the round ends you set RT.Value to negative one, and == means given value must be like the other value,
you can solve this by changing RT.Value = -1 into 0 or changing RT.Value == 0 into RT.Value <= 0

2 Likes

This is already in the top of the loop changing it back to 35 at the start of the new loop so the -1 shouldn’t be changing it, the reason I have it set to -1 is so when the loop starts it doesn’t start with a round time of 0 causing the round to automatically end.

1 Like

why is there a loop in the first place? I’ve made round games before and I’ve never needed to use a loop when ending a game (or I just end the game from the server)

It was set up that way because I didn’t originally write the script for them I’m trying to fix the game, and I re wrote everything to basically play on this loop. I mean if you would write the beginning differently then by all means. I just want this to play every single time the activated games value is true. Without failing, it was just a looped script to make the game continuously run but it doesn’t need to be.

1 Like

You really need to format your code better, the readability of this makes it 10x harder to debug

1 Like

Again fixing the code for someone else, I didn’t write the code from the ground up, otherwise this would be split up into many different scripts to simplify however. This one script is already firing and doing a lot of events so re working it is way beyond rn.

1 Like

@Fire_Scout makes a great point, this code is a bit difficult to debug. I understand that you are unable to rewrite the code, but I do recommend cleaning up the code

I would agree if the script was actually breaking but it isn’t, nor is the loop actually failing anything now, besides the game.ReplicatedStorage.Winner.Entity.Value = true that’s the only thing the script isn’t doing that’s making it not fire the End event. If there is a way that I could bypass this make it call for the winner value true when round time hits 0 then it would work.

I’m gonna try separating it and stating that
Maybe this will help break up the script enough where it won’t exhaust

if RT.Value == 0 then
Game.ReplicatedStorage.Winner.Value = true

ElseIf game. Replicatedstorage.Winner.Value == true then

The rest of the code.

End:fireallclients()

1 Like