Need help with my Dragon Attack Code

Hello,
So basically here I am trying to make an AI code for my Dragon. But the problem is that I cannot make it work.


This is the code that fires the Remote Event of the Attack :

This is the Explorer:
image

This is the script that makes the attack when the Remote is fired:

And these is the errors I get which is from the script that fires the remote :

Argument 1 missing or nil  -  Server - AI:11
OnClientEvent can only be used from the client.

I’m pretty sure the errors are the “:FireClient()” and the “OnClientEvent” but I don’t know how to make them work. I also don’t know if the AI script should be a server script or local script.

Any help is really appreciated, thanks! :smiley:

FireServer() can only be used in LocalScripts.
OnServerEvent() listens to the FireServer() call by a client so it has to be in a ServerScript.

If you want your 2 scripts to talk Server-Server then consider using a BindableEvent.

Also make sure your RemoteEvents are in a place where both the Client and Server can access them (such as ReplicatedStorage).

1 Like