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

Argument 1 missing or nil on firing client?

So the thing is that when the player touched the object, it fires the remote event for the client and once fired, a gui will show, Any help?

-- Main Script coded in a Script

local function acti()
	_G.Wall1.Disabled = false
	_G.Wall2.Disabled = false

	game.ReplicatedStorage.RemoteEvent:FireClient()
end


script.Parent.Touched:Connect(acti)

-- Receiver coded in a Local Script:

local function activateSpook()
	script.Parent.Enabled = true
end

game.ReplicatedStorage.RemoteEvent.OnClientEvent:Connect(activateSpook)

2 comments

0

Which line gives that error?

0

Line 5 In main script

2 answers

✓ Accepted answer

You need to fire a player instance when firing to a specific client. Since Touched event returns hit parameter, and you can use hit.Parent for the character. By using :GetPlayerFromCharacter it returns a player instance for the following character. Replace the line 5 as:

game.ReplicatedStorage.RemoteEvent:FireClient(game:GetService("Players"):GetPlayerFromCharacter(hit.Parent))

Hover over the Lua block and press "Open Source" to view the full lua block! (Since it's too long)

When using

:FireClient()

you have to add a player in the brackets so the computer knows who to fire the event to. Like so:

:FireClient(player)

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