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

Help with Firing a remote event and getting Argument 1 missing?

local debounce = false game.Workspace.EverythingTP.ClickDoorArch1.ClickDetector.MouseClick:Connect(function(hit) print("touched") if not debounce then print("about to start event") game.ReplicatedStorage.Events.Gui:FireClient() print("event started") end end) it gets to about to start event but it doesn't fire the client I keep getting this error saying Argument 1 missing or nil for the fireClient line of code help?

1 answer

✓ Accepted answer

When you use FireClient, it has a few parameters. First, you have to specify in the first argument what player you want to fire the remote event to. Type in something like this:

local debounce = false
game.Workspace.EverythingTP.ClickDoorArch1.ClickDetector.MouseClick:Connect(function(hit) 		 
    print("touched") 
    if not debounce then 
        print("about to start event") 
	game.ReplicatedStorage.Events.Gui:FireClient(player) --insert player to fire the event to 
	print("event started") 
    end 
end) 

If you want all players to receive it, do this:

local debounce = false
game.Workspace.EverythingTP.ClickDoorArch1.ClickDetector.MouseClick:Connect(function(hit) 		 
    print("touched") 
    if not debounce then 
        print("about to start event") 
	game.ReplicatedStorage.Events.Gui:FireAllClients
	print("event started") 
    end 
end) 

Hope this works. If it does not, then let me know.

2 comments

0

i want the player who clicked the block to get the event fired to not everyone and i tried your top one but thee player is underlined in blue help?

0

Oh thats simple, when you use the mouseclick event for a clickdetector, the parameter is the player who clicked on it, so you can just put that in fire clients

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