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

FE help required!? (Firing from server)

Asked by
Zyleak 70
8 years ago

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
You have to pass in the player as an argument to the FireClient call. Player.Backpack.Controls.DisableControls:FireClient(Player) GoldenPhysics 474 — 8y

1 answer

Log in to vote
0
Answered by 8 years ago
Edited 8 years ago

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.

Ad

Answer this question