Argument 1 missing or nil

Hello, I’m trying to add a transition to a menu script although when the client fires ‘Argument 1 missing or nil’ shows. This is probably a simple mistake I made but any help is appreciated.

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local RunService = game:GetService("RunService")
local Players = game:GetService("Players")

local TransitionEvent = ReplicatedStorage.Events:FindFirstChild("TransitionEvent")

local Mouse = Players.LocalPlayer:GetMouse()

local MenuCamera = game.Workspace:FindFirstChild("MenuCamera")
local Camera = game.Workspace.CurrentCamera

local Title = script.Parent:FindFirstChild("Title")
local Play = script.Parent:FindFirstChild("Play")

function UpdateCamera()
	local Center = MenuCamera.CFrame
	Camera.CFrame = MenuCamera.CFrame * CFrame.Angles(math.rad(-(Mouse.Y - Center.Y) / 200), math.rad(-(Mouse.X - Center.X) / 200), 0)
end

RunService.RenderStepped:Connect(UpdateCamera)

TransitionEvent:FireClient()

Title.Visible = true
Play.Visible = true

Play.MouseButton1Click:Connect(function()
	Camera.CameraType = Enum.CameraType.Custom
	script.Parent:Destroy()
end)

I think it would be better if you can show us which line the error points to.

The line with the error is the fire client line. I can share the transition script with you too if you need it.

Oh I see the problem now.

You are calling :FireClient(), and this function expects a player instance inside the argument to fire this event to, in which you didn’t. Are you trying to fire this event to the server or the client?

1 Like

I’m just trying to fire it for the client.

Which client? The client that fired the remote event or someone else?

The one that fired the remote event.

Then you should include Players.LocalPlayer in between the brackets.


Alright I tested it but this error shows in the output.

This might be a misunderstanding of Remote Events. You’re attempting to :FireClient() from a LocalScript. Peer-to-peer communication doesn’t exist, clients can only fire to the server with :FireServer().
Only the server can call :FireClient()

If you mean to communicate within one clients’ scripts, perhaps you need BindableEvents, not RemoteEvents?

2 Likes

Oh well, then you have to fire to the server first with the player instance that fired the remote event as an argument and then let the server fire the remote event to the supplied argument (the client).

EDIT: or you can read the above post’s reply by @MP3Face.

2 Likes

Alright I’ll look into it thanks for the help.

umm did you difne what player or waht client that the event is firing for?

for example, let’s say a remote event when fired on client then makes the baseplate red, and you use FireClient() as it is only used in server scripts/normal scripts and not local/client scripts, you need to tell what client the events is firing on