ParticleEmitter LocalScript

Hey there everyone,

so, i have been trying to create some cool ParticleEmitter in the past 15-20 minutes and I managed to do it! :smiley: but, i kinda stuck in the middle of the process so, im trying to make a button when the player holds it. It activates this ParticleEmitter in the Head, HumanoidRootPart, Left Arm, Left Leg, Right Arm, Right Leg, Torso, and thats all. also, i think its going to be a LocalScript in StarterPlayer in StarterPlayerScripts?

image

this is moving this ParticleEmitter in the body but, i dont have a video recorder rn to record it. :frowning:
image

1 Like

I am confused. Can you explain more?

Are you saying that you want the button to activate the ParticleEmitter?

2 Likes

Yes, I’m trying to create a button that is “J” when the player holds it. it’ll automatically activate the ParticleEmitter in Head, HumanoidRootPart, Left Arm, Left Leg, Right Arm, Right Leg, Torso. its going to be a LocalScript in StarterPlayer in StarterPlayerScripts i think not sure 100%.

1 Like

could you provide an example? that i can understand so, i can use it. :confused:

1 Like

There are code samples on the pages MrLegendaryDoge provided you with. I would look at the code sample on the ContextActionService as it looks like something that is similar to what you are doing but not exactly.

2 Likes

The following example should be a decent starting point. You will need to put a RemoteEvent with the name “ToggleParticles” under ReplicatedStorage for this to work properly.


LocalScript under StarterPlayerScripts

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local ContextActionService = game:GetService("ContextActionService")
local ToggleParticles = ReplicatedStorage.ToggleParticles

local function Activate(Action, State, Input)
	if State == Enum.UserInputState.Begin then
		ToggleParticles:FireServer(true)
	elseif State == Enum.UserInputState.End then
		ToggleParticles:FireServer(false)
	end
end

ContextActionService:BindAction("ToggleParticles", Activate, false, Enum.KeyCode.J)

Script under ServerScriptService

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local ToggleParticles = ReplicatedStorage.ToggleParticles

ToggleParticles.OnServerEvent:Connect(function(Player, State)
	if not Player.Character then return end
	
	for i, v in pairs(Player.Character:GetDescendants()) do
		if v:IsA("ParticleEmitter") then
			v.Enabled = State
		end
	end
end)
2 Likes

Thanks! I did it but, sadly, didn’t work maybe there is a place where I have to save the “Test” model? Not sure… Well, if your going to ask me where did I insert it. I have inserted it in Workspace. :confused:

1 Like

This setup assumes that the emitters are already in the character model. Is there any way you could post the place file so that I can see how you’re applying it?

Edit: Just to clarify, this is meant to affect each player—not a test model.

2 Likes

Okay, here you go. Also, yeah to affect each player.
Baseplate.rbxl (41.9 KB)

1 Like

You were missing a method by which to add particles into each player’s character. You can see my revisions here: Particles.rbxl (42.1 KB)

Going forward, I suggest optimizing this to use a single emitter. Let me know if you have any more issues.

2 Likes