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

How do you add particles to torso at the touch of a key?

--Always remember to indent your code so it can be easier to read.
local UserInputService = game:GetService("UserInputService")
local localPlayer = game.Players.LocalPlayer
local Torso = localPlayer.Character.Torso --The Torso variable you probably forgot to make.
 
local function onInputBegan(input, gameProcessed)
if input.UserInputType == Enum.UserInputType.Keyboard then
local keyPressed = input.KeyCode
if keyPressed == Enum.KeyCode.LeftShift then
local w = Instance.new("Weld",localPlayer.Character)
w.Part0=game.Workspace.Meshpart --We weld the Meshpart to the part0 property.
w.Part1=Torso --Take it to the Torso variable.
w.C0=CFrame.fromEulerAnglesXYZ(0,0,0)*CFrame.new(0,5,0) --CFrame it to adjust the positioning
while welded 
Instance.new("ParticleEmitter",Torso) --Instance the particleemitter on the characters Torso.
end end end
UserInputService.InputBegan:connect(onInputBegan)

1 answer

Your issue is somewhere near...

while welded
	--do things
end

Welded is not defined, and you're missing a do after welded.

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