Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why FireClient() gave me argument 1 missing or nil?

Asked by
royee354 129
6 years ago
Edited 6 years ago

Ok so I am using a Global Script that is inside of a part, that has a click detector

Script:

script.Parent.ClickDetector.MouseClick:connect(function()
script.Parent:FindFirstChild("RemoteEvent"):FireClient()
end)

It is giving me Argument 1 is missing or nil, why? [Part Answered ]

The local script won't work, I got the thing to fire but the following local script won't do a thing any ideas on how to fix it?

Local Script:

enabled = true
game.Workspace.Lantern.Bulb.RemoteEvent.OnClientEvent:connect(function()
if enabled == true then
    enabled = false
    local StarterGui = game:GetService('StarterGui')
StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Backpack, false)
end
end)
1
gotta include a player. TheBenSquare 47 — 6y
0
Yes. Never forget that. Zafirua 1348 — 6y
0
Works but, the local script won't work, I will edit the question. royee354 129 — 6y

1 answer

Log in to vote
3
Answered by 6 years ago
Edited 6 years ago

FireClient has to have a Player as an argument, RemoteEvent:FireClient(Player)

As far as the local script goes, you could try printing out something. If it runs then you'll know that the event fired. If not then try searching the developer console for any errors that occur.

Server Script:

script.Parent.ClickDetector.MouseClick:Connect(function(Player)
    script.Parent:FindFirstChild("RemoteEvent"):FireClient(Player)
end)

Local Script:

local enabled = true
local StarterGui = game:GetService('StarterGui')

workspace:WaitForChild("Lantern").Bulb.RemoteEvent.OnClientEvent:Connect(function()
    if enabled then
        enabled = false
        StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Backpack, false)
    end
end)
0
Thanks, but I need one more thing please edit your answer so I can accept it, because I got only the half of what I really needed, and I think that it will be bad to open another question just for that. royee354 129 — 6y
0
Actually you do deserve it because you actually answered my question, would be appreciated if you edit it so I can know why the local script is not working? I will accept your answer. royee354 129 — 6y
0
Works thanks. royee354 129 — 6y
Ad

Answer this question