RemoteEvents are not working?

So yeah, I think I’m just being really dumb here, but can someone review my code?

SERVER CODE:

       function NewRound(MiniGame, transmissionlength)
	    --im vommiting from this code
	    local placevector = Vector3.new(0, 0, 0)-- defaults to 0
		
	 if MiniGame == "RedLight" then
		print("RedLight Was Chosen")
		placevector = Vector3.new(100, 0, 100) -- example area
		game.ReplicatedStorage.RoundSystem.TransportLocalPlayers:FireAllClients(MiniGame, transmissionlength, placevector)
	elseif MiniGame == "Example2" then
		print("Example")
	else 
		print("Invaild MiniGame Type!")
	end
	
	
    end

    NewRound("RedLight", 10)

LOCAL CODE:

game.ReplicatedStorage.RoundSystem.TransportLocalPlayers.OnClientEvent:Connect(function(plr, Minigame, transmissionlength, placevector)

print(Minigame) --make sure arugments are accepted

print(transmissionlength) --lol

print(placevector) -- lmao

print("um")

end)
1 Like

One thing I’m seeing is that you have a plr parameter in your local code. FireAllClients() does not specify specific players when it executes, as it fires to all clients, so that parameter will be nil.

1 Like

I removed player, still not working, anything else?

1 Like

Formatting your code is important!

function NewRound(MiniGame, transmissionlength)
	-- im vomiting from this code
	local placevector = Vector3.new(0, 0, 0) -- defaults to 0

	if MiniGame == "RedLight" then
		print("RedLight Was Chosen")
		placevector = Vector3.new(100, 0, 100) -- example area
		game.ReplicatedStorage.RoundSystem.TransportLocalPlayers:FireAllClients(MiniGame, transmissionlength, placevector)
	elseif MiniGame == "Example2" then
		print("Example")
	else 
		print("Invaild MiniGame Type!")
	end
end

NewRound("RedLight", 10)
game.ReplicatedStorage.RoundSystem.TransportLocalPlayers.OnClientEvent:Connect(function(plr, Minigame, transmissionlength, placevector)
	print(Minigame) --make sure arugments are accepted
	print(transmissionlength) --lol
	print(placevector) -- lmao
	print("um")
end)

Also, consider that the player might not have joined by the time :FireAllClients() has ran. Notice how it says RedLight Was Chosen before === Join Completed ===.
image

Adding a delay worked. Keep in mind this is not a permanent solution. You should tell new clients what minigame is currently ongoing, but I’ll leave implementing that to you. :slight_smile:
image

1 Like