Issue when using :FireAllClients()

I’m trying to make a cutscene skip code, sending a :FireServer() event to add the player onto a table and see if the ammount of players is a certain ammount and if so it skips. I’ve been searching through everywhere and looking back at my code about 100 times still nothing as worked.

Local Script

while task.wait() do
	if isHoldingSpace then
		task.wait(.05)
		holdingTime += .05
	end
	if not isHoldingSpace then
		holdingTime = 0
	end
	if holdingTime >= 1.5 then
		SkipEvent:FireServer(player)
	end
end

SkipEvent.OnClientEvent:Connect(function()
	print("I'm listening for FireAllClients")
end)

Script

SkipEvent.OnServerEvent:Connect(function(player)
	if table.find(playersSkip, player) then
		return
	else
		table.insert(playersSkip, player)
	end
	if #playersSkip == playersTotal then
		print("Yes it's equal")
		SkipEvent:FireAllClients()
		table.clear(playersSkip)
	end
end)

Thank you in advance.

1 Like

Forgot to add but this is what the output gives:
imagem_2024-01-21_095005354

Always put an infinite while loop at the very end of the script as it prevents any code below it from running

Jesus Christ, thank you didn’t think that would matter much.

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