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

FE help required!? (Firing from server)

I'm attempting to learn Filtering Enabled currently. I am having issues in disabling player controls from the server.

This is in the server:

Player.Backpack.Controls.DisableControls:FireClient()

(All defined correctly)

And this is in the client:

local Player = script.Parent.Parent
DisableControls = script:WaitForChild("DisableControls")
DisableControls.OnClientEvent:connect(function()
	Player.PlayerScripts.ControlScript.Disabled = true
end)

The issue seems to be with firing it from the server as I get an output of "Argument 1 missing or nil". How would I got about fixing this?

Thank you!

-Quinn

1 comment

1

You have to pass in the player as an argument to the FireClient call. Player.Backpack.Controls.DisableControls:FireClient(Player)

1 answer

✓ Accepted answer

If you are using FireClient (in the server script), then who do you want to fire the event to? You MUST mention the player to fire as the first argument.

Player.Backpack.Controls.DisableControls:FireClient(game.Players.PLAYERNAME) -- This will fire to a certain client.

OH! Also, if you are attempting to fire the event to ALL the players, then use FireAllClients. This will fire the event to all the clients (players).

Player.Backpack.Controls.DisableControls:FireAllClients() -- Fires to ALL clients, the arguments vary on the listener (LocalScript).

That's all I can tell you when using RemoteEvents.

If you have any questions, leave them in the comments below. Thank you and I hope this will help you.

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