Hello Devs, So, im new at scripting and i was trying to put an particle on my Humanoid LeftArm, RightArm and Head but, i dont know how to do it.
my character is R6
im doing this by Touched Event
If i type Humanoid.LeftArm or Humanoid.Head, this error appear: “LeftArm is not a valid member from tutizillig.Workspace.Humanoid”. How can i fix that?
humanoid is the component which controls the player, the stuff you’re looking for is their character
example
workspace:WaitForChild("tutizillig").LeftArm
--[[
workspace:WaitForChild("tutizillig") is your character, inside of
the character is your left arm
look at a character like a body
]]--
I would recommend finding it using localplayer.
If he changes his name this will stop working, and it won’t work on anyone else.
Instead, send the player’s name that you want to give the particle effect though to the serverscript from a localscript with a remoteevent.
local Part = script.Parent
Part.Touched:Connect(function(p)
if p.Parent:FindFirstChild("Humanoid") and p.Parent ~= nil then --Look if it's a humanoid and if it exists
for i,v in pairs(p.Parent:GetChildren()) do --Cycle through the player's children
if v.Name == "Head" then
local particle = Instance.new("ParticleEmitter",p) --Insert a new Particle
elseif v.Name == "Left Arm" then
local particle = Instance.new("ParticleEmitter",p)
elseif v.Name == "Right Arm" then
local particle = Instance.new("ParticleEmitter",p)
end
end
end
end)
it gave me this error: “attempt to index function with Parent”
also, this is my script:
local serverstorage = game:GetService(“ServerStorage”)
local particle14 = serverstorage:WaitForChild(“kills114”)
local particle114 = particle14:Clone()
particle114.Parent = Humanoid.RightLeg
local serverstorage = game:GetService(“ServerStorage”)
local particle14 = serverstorage:WaitForChild(“kills114”)
for i,v in pairs("Humanoid"):GetChildren()) do
wait()
if v.Name == "Head" or v.Name == "Left Arm" or v.Name == "Right Arm" then
local par = particle14:Clone()
par.Parent = v
end
end
First off, add a script in StarterCharacterScripts:
Paste this into the script:
--//Services
local ServerStorage = game:GetService("ServerStorage")
--//Variables
local Particle = ServerStorage.kills114
local Character = script.Parent
--//Tables
local ValidParts = {
"Head",
"Left Arm",
"Right Arm",
}
--//Functions
for i, child in ipairs(Character:GetChildren()) do
if table.find(ValidParts, child.Name) then
local newParticle = Particle:Clone()
newParticle.Parent = child
end
end