How to use Remote Events in Tools?

I am currently testing out the use of remote events inside tools.

I want to make the tool emit particles from a server script. I have it set up so that the local script detects the tool’s activation which then fires a remote event to the server script so the server script could enable the particle emitter.

The tool is inside the starter pack.
image

What is the Issue?
The issue is that the remote event won’t fire and the error, “RemoteEvent is not a valid member of Tool” keeps popping up when I run the game.

image

Here are my scripts:

Local Script:

local remoteEvent = script.Parent.RemoteEvent

local tool = script.Parent

tool.Activated:Connect(function()
	
	remoteEvent:FireServer()

end)

Server Script:

local remoteEvent = script.Parent.RemoteEvent
local particleEmitter = script.Parent.Handle.ParticleEmitter

remoteEvent.OnServerEvent:Connect(function()
	
	particleEmitter.Enabled = true
	
end)

Does anyone have a solution to this? What is the best way to incorporate remote events in tools? Is there any other way to communicate between server and local scripts in tools?

I want to know how to use Remote events with tools so don’t tell me to put the tool activated event in the server script and the enable particle emitter in the activated event.

You can use Tool.Activated inside of a server script so you don’t need a RemoteEvent.

But for future reference, you need to use :WaitForChild inside of the server script to get the event because the script will run before the event is loaded into the game.

So it would be:

local remoteEvent = script.Parent:WaitForChild("RemoteEvent")

You would also need to do that to get the particle emitter.

4 Likes