Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How do i make particles emit from a player due to a click of a button?

I want to make particles emit from my players torso from clicking the key "F" but a dont really know how to do that.

1 answer

Hello,

to emit particles from an object, all you have to do is create a particle emitter and set it to be a child of that object. If you were to add particles to the torso of the player, you would just have to instance a particle emitter in a local script. It would look something like this:

local player = game:GetService("Players").LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local upperTorso = character:WaitForChild("UpperTorso")

local particlesEmitter = Instance.new("ParticleEmitter", upperTorso)

[Edit]:

You also need to implement user input, which is easily done with the help of the UserInputService. All you have to do is connect the "InputBegan" event to a function which will enable the particleEmitter:

local userInputService = game:GetService("UserInputService")
local player = game:GetService("Players").LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local upperTorso = character:WaitForChild("UpperTorso")

local particlesEmitter = Instance.new("ParticleEmitter", upperTorso)
particlesEmitter.Enabled = false

userInputService.InputBegan:Connect(function(input)
	if input.KeyCode == Enum.KeyCode.F then
		particlesEmitter.Enabled = true
	end
end)

Hope this helps.

This discussion is preserved as it was. New answers, comments, and votes are closed.