Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

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

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)

3 comments

1

gotta include a player.

0

Yes. Never forget that.

0

Works but, the local script won't work, I will edit the question.

1 answer

✓ Accepted answer

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)

3 comments

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.

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.

0

Works thanks.

This discussion is preserved as it was. New answers, comments, and votes are closed.