Argument 1 missing or nil client event

LocalScript which has onclientevent information

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local StarterGui = game:GetService("StarterGui")

local RemoteEvent = ReplicatedStorage:WaitForChild("Intermission")
local TextLabel = StarterGui.ScreenGui:WaitForChild("TextLabel")

RemoteEvent.OnClientEvent:Connect(function()
	for i = 10, 0, -1 do
		task.wait(1)
		TextLabel.Text = "Intermission: " .. i
	end
end)

Script

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local StarterGui = game:GetService("StarterGui")

local textLabel = StarterGui.ScreenGui:WaitForChild("TextLabel")
local lobbyRemaining = 10
local timeRemaining = 10
local InGame = game.Workspace:WaitForChild("InGame")
local InLobby = game.Workspace:WaitForChild("InLobby")
local timeLeft = 10
local lobbyLeft = 10

local killPlayer = ReplicatedStorage:WaitForChild("killPlayer")
local intermission = ReplicatedStorage:WaitForChild("Intermission")

local teleportPlayers = ReplicatedStorage:WaitForChild("TeleportPlayers")
local tp1 = game.Workspace:FindFirstChild("tp1")
local tp2 = game.Workspace:FindFirstChild("tp2")
local players = game:GetService("Players"):GetPlayers()

while true do

	if InLobby.Value == true then
		intermission:FireClient()
		-- set these values after the for loop, do not need to check i == 0
		InLobby.Value = false
		InGame.Value = true
	elseif InGame.Value == true then
		teleportPlayers:FireServer()
		for i = 10, 0, -1 do

			task.wait(1)
			textLabel.Text = "Time remaining: "..i
		end

		InGame.Value = false
		InLobby.Value = true
		killPlayer:FireServer()
	else
		error("Not in lobby or game!") -- errors help debugging
	end
end

Basically looking for intermission to run on the client-side. Any help is very appreciated

Here, you need to provide the client [the player] whom you want to execute that event on.
Also , let me now take more glances.

Thank you will try that now I have tried the player parameter will try something again

1 Like

When you’re using FireClient, you always need to provide a client[player] as the first argument.

Also, you can not use FireServer on a ServerScript.
Use FireAllClients instead.

Like this?

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local StarterGui = game:GetService("StarterGui")

local RemoteEvent = ReplicatedStorage:WaitForChild("Intermission")
local TextLabel = StarterGui.ScreenGui:WaitForChild("TextLabel")

RemoteEvent.OnClientEvent:Connect(function(player)
	for i = 10, 0, -1 do
		task.wait(1)
		TextLabel.Text = "Intermission: " .. i
	end
end)

I just am not sure how to add the player object when firing the event

When using FireClient(Client), and calling it on the client [ using OnClientEvent] you dont need to provide that player again, it is automatically there! If you want to modify / do something with that player, provide him again as a 2nd argument.

You need to provide a single client here, but doesnt seem that you have one. You could get a single player by looping through all players in game for example.

All I am really looking for is just for the intermission to work on the client it just seems complicated to me lol

If I was to :FireClient() do i need the players I want it to fire too or is it just automatic?

May I ask why you want the intermission to be on the client? Also, you do not need the player for FireClient(), but you do need to put it in for OnClientEvent(Player, …)

I thought if I run the intermission on the script it just runs on the server but won’t show up on the client that’s why

For my round system, I have everything on the server, and I change the value of a StringValue to represent the intermission, in-game, round finished, etc. On the client, if the value is changed, I put the value on the gui. Plus, you have to remember that anything on the client, there is a chance for an exploiter to change that. Also, exploiters can fire remote events willingly.

1 Like

If I don’t put anything in :FireClient() then it gives me error: “Argument 1 missing or nil”

Yea I was told about that in a discord server

You do need the Player for FireClient, as you’re firing to a specific user. OnClientEvent does not have the player as the first parameter, only OnServerEvent

https://developer.roblox.com/en-us/api-reference/function/RemoteEvent/FireClient
https://developer.roblox.com/en-us/api-reference/event/RemoteEvent/OnClientEvent
https://developer.roblox.com/en-us/api-reference/event/RemoteEvent/OnServerEvent

1 Like

Oh okay, I haven’t used FireClient in a few weeks :sweat_smile: .

I may just use a stringvalue instead is probably the best bet instead of using fireclient ill test that out first

tried string value seems to be working great so far made a while loop that updates every second