Error "FireServer can only be called from the client" when giving cash to player

I’m making a tycoon and I have made a goblin enemy. Upon killing the goblin, the player should recieve 10-30 cash (Gold), and I am using a RemoteEvent to do so, however, when I test and kill the goblin I get an error saying “FireServer can only be called from the client”. Can anyone help?

Is that in a server script or local script?

You’re trying to use :FireServer() on the server, but that’s not what that function was designed to do. What you meant to use was :FireClient().
Please read the good docs that Roblox provided, it will help.
[Bindable Events and Functions | Roblox Creator Documentation]

It is in a normal script.

i need to make this 13 characters

Alr, FireServer(), can only be called in a local script.

Make sure that code is in a local script cause that’s the only way the FireServer() can work.

You would have to fire it on a local script otherwise it won’t work.

I know this has been mentioned before but just gonna give the documentation

Hello kitekite40!

For more information on RemoteEvents, check out the link at the bottom of my post.

If you are trying to communicate from Client-Server, you would use :FireServer() in a localscript.
If you are trying to communicate from Server-Client, you would use :FireClient() in a serverscript.

If you are trying to communicate between two scripts, local or client, you can use a BindableEvent to communicate. Keep in mind, you can only communicate from Server-Server or Client-Client.

RemoteEvent (roblox.com)
BindableEvent (roblox.com)

4 Likes

Thank you! This helped me out as well.

FireServer can only be used on a LocalScript (As others said). However, if you are trying to add the cash to the player on the server, from the server, then you can use a BindableEvent.

Ok, this helped me out a lot