so, i have been trying to create some cool ParticleEmitter in the past 15-20 minutes and I managed to do it! 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?
this is moving this ParticleEmitter in the body but, i dont have a video recorder rn to record it.
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%.
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.
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)
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.
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.