Ad
Still have questions? Join our Discord server and get real time help.
Log in to vote
0

FireClient can only be called from the server?

Asked by 2 years ago

Hello everyone i am trying to make so that when you press a button it passes a parameter of the player and the button to another script. It's working in studio altough not when playing on a server ingame. I don't know what i have done wrong. The error i get from the command console is:

"FireClient can only be called from the server".

Local Script that passes the arguments and triggers the event:

script.Parent.MouseButton1Click:connect(function(plr)
    game.Workspace.Shop_Script.RemoteEvent:FireClient(plr,script.Parent, script.Parent.Parent.Parent.Parent.Parent.Parent)
end)

my event:

script.RemoteEvent.OnClientEvent:connect(function(par, plr)
--My code
end)

Anyone know what i have done wrong?

Help would be really appreciated, thanks!

0
The error explains itself. you are using FireClient in a local script. User#5423 0 — 2y
0
Yes, :FireClient() can only be called on server since you're firing an event from client side. That's where OnClientEvent function responds on the client side. :FireServer() is on client, since you're trying to fire from server respectively. OnServerEvent function is now on server side, since it's responding to :FireServer() liteImpulse 47 — 2y
0
Try and practice this as much as you can, that way you get used to it. liteImpulse 47 — 2y
0
Ok, thanks i solved it now! bondhemlig 20 — 2y

Answer this question