Script stops printing

Ok so I’m trying to make a round script then I come across an error. The in the script below everything prints fine, but it doesn’t print “hi2”. I have no clue why, but that is causing the rest of my script to fail.

-- Serverscript in serverscriptservice
function Intermission()
    game.ReplicatedStorage.ShowVotes:FireAllClients()
	workspace.Sound1:Play()
		for i = 10,1,-1 do
			text.Value = "Intermission "..i
			wait(1)
		end
	
	print("Yay")
	game.ReplicatedStorage.Function:Fire()
	print("yay2")
end

while true do
   Intermission()
   break
end

game.ReplicatedStorage.Function2.Event:Connect(function()
print("Hi")
local function Gamemode() 
wait()  
game.ReplicatedStorage.WhichGamemode.OnInvoke = function(chosen)
print("Hi2") -- here is print statement that doesn't print

Thanks and have a great day/night!

2 Likes

What functions are you connecting to here? Where are the ends?

The script is unfinished it seems like it, please correct it. "Hi2" doesn’t print straight away because obviously, Function2.Event needs to be fired, Gamemode needs to be called, and WhichGamemode.OnInvoke needs to be informed, until "Hi2" gets printed. If your problem is "Hi2" not printing when those things happen, it might be a problem with Function2.Event, maybe it’s not firing.

I fired it in another script, but that works fine

Well can you show the rest of the script?

I don’t want to leak the rest of my code though…

So:
The script works,
but it only stop to printing?

I have the same problem too…

Well no, its stops printing, and it stops working

Pls no, just do Intermission(), you not need the whole while-loop. And what exact is not printing? Everthing or just some lines? Then:
Have you tried the debugger? If no, before you ask me „But how the debugger works?“, then just use a very magical machine. Its name is google, srly.

1 Like

I did that for a reason… So basically, I want to fire the function once so it starts, then the loop breaks because from now on, that function will fire once the round is over

Also, do you really think looking on google can solve this???

1 Like

Maybe, idk


Its the same, just call the function. Pls try before.

Is there any way to delete it? I only want it to call the function once, and then delete itself

or else use the debugger:

Why would I need to show the rest of my code anyway? It stops working in the code I showed you…

First, you didn’t end your functions, that might cause an error, because after it runs, it didn’t end, but I am not sure. And second, why are you calling that while loop if the code runs only once? You break it right after the function finishes.

Where’s the end to these functions?

Well is there a way to call a function, and then destroy it? like function() calls once, then destroyed.

1 Like

Yes, : Disconnect () to the connection, I’ll add the link to the page here:

This part is kind of redundant. You might as well just call the function without the loop.

2 Likes

No I meant like

  ''''
        function blahblah()
             print(ghuhjh)
        end
         
       blahblah() -- after the function is called, I want to delete this <--

       '''