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)
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?
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?
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.
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