How to trigger an event with a tool

I’m trying to make a tool where when activated, a remote event is triggered that creates a part in front of the player to serve as the attack hitbox, but I can’t get the tool to work.

game.ReplicatedStorage.TestEvent:FireServer()

This line works in a local script in response to a key press, but in the tool it causes an error saying FireServer can only be called from the client, and FireClient() causes an error saying Argument 1 missing or nil.
I’m also worried that FireClient() won’t trigger the event since the event response script is in response to a server event:

game.ReplicatedStorage.TestEvent.OnServerEvent:Connect(function(player)

Try OnClientEvent
al;sdkfjas;fjals;

When using FireClient() you have to pass in the Player as the first argument

The script doesn’t allow OnClientEvent

Then @domboss37’s idea might work

What would I type for that? The tools parent or just the name of the function causes an error saying FireClient: player argument must be a Player object

You would pass in the parameter like this at the end:

game.ReplicatedStorage.TestEvent:FireClient(Player)

Tried that,

Tool.Activated:Connect(function(Player)
game.ReplicatedStorage.TestEvent:FireClient(Player)
end)

Just causes the player argument must be a Player object error

No need to provide Player as an argument in the Activated event.

Also, I assume this is a ServerScript, right?

Everything’s a server script except the local script that I used to test if the event function worked on just a key press(which it did)

You cannot call FireServer from a Server Script, only from a LocalScript. If it mentions that FireServer can only be called from the client, you’re not calling it from a LocalScript.

Could I just make a local script to the player that checks if a tool is equipped, and reacts to clicks to simulate like the tool is being used?