Client not receiving remote event?

You can write your topic however you want, but you need to answer these questions:
I have a remote event being fired from the client and then to server, then back to the client, and while the client is firing the event succesfully with the server receiving, however whenever the server fires the event back, the client doesnt seem to recieve

Client:

local button = script.Parent
local event = game.ReplicatedStorage.RemoteEvents.DebugNextEntitySpawnEvent

while task.wait(0.5) do
	if script.Parent.Parent.Visible == true then
		print("clientfired")
		event:FireServer()
	end
end

event.OnClientEvent:Connect(function(number)
	print("clientrecieved")
	button.Text = "Next Spawn: "..number
end)

Server:

DebugNextEntitySpawnEvent.OnServerEvent:Connect(function(player)
	if table.find(adminTable, player.Name) then
		print("serverrecieved")
		print("serverfired".. player.Name)
		DebugNextEntitySpawnEvent:FireClient(player, entityNextSpawn)
	end
end)

Untitled

Any solutions?

Normally, scripts execute line-by-line, from left → right. If you have a loop in your script, it hijacks the this normal execution flow by returning execution to the top of the loop so long as its condition remains true. This is how a loop’s body is repeated. Your loop’s condition will never turn false, and there are no internal break statements. This prevents your script from executing any code beyond the loop, which is where you placed your RemoteEvent.OnClientEvent handler. Your situation isn’t complicated, so you can simply move that code above the loop

I see, maybe i should have paid more attention, thanks!

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