Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

how do i place a particleemiter on multiple character parts easier?

Asked by 6 years ago
Edited 6 years ago

Hello, i was just wondering if there is an easy way to do this since i would have to do this with every other body part, look at the code and the disabled line to understand, yes i know that the disabled line won’t work like i want it to. i just started lua so don’t judge me :P

01local p1 = game.ServerStorage.Nebulea1
02 
03local p2 = game.ServerStorage.Nebulea2
04 
05local p3 = game.ServerStorage.Nebulea3
06 
07local p4 = game.ServerStorage.Nebulea4
08 
09   
10 
11game.Players.PlayerAdded:Connect(function(plr)
12 
13plr.CharacterAdded:Connect(function(char)
14 
15local plrP1 = p1:Clone()
16 
17local plrP2 = p2:Clone()
18 
19local plrP3 = p3:Clone()
20 
21local plrP4 = p4:Clone()
22 
23--plrP1.Parent = char.UpperTorso, char.LowerTorso, char.RightLowerArm, char.LeftLowerArm, char.RightLowerLeg, char.LeftLowerLeg
24 
25plrP2.Parent = char.UpperTorso
26 
27plrP3.Parent = char.UpperTorso
28 
29plrP4.Parent = char.UpperTorso
30 
31end)
32 
33end)
0
Loop thorugh the player and clone to the parts that r being looped though using in pairs AizakkuZ 226 — 5y

1 answer

Log in to vote
0
Answered by
H3kken -4
5 years ago

Make a for loop that loops though the player's meshparts/bodyparts. This should work:

01game.Players.PlayerAdded:Connect(function(plr)
02 plr.CharacterAdded:Connect(function(chr)
03 local p1 = game.ServerStorage:WaitForChild("Nebulea1")
04 local p2 = game.ServerStorage:WaitForChild("Nebulea2")
05 local p3 = game.ServerStorage:WaitForChild("Nebulea3")
06 local p4 = game.ServerStorage:WaitForChild("Nebulea4")
07 local Cp1 = p1:Clone()
08 local Cp2 = p2:Clone()
09 local Cp3 = p3:Clone()
10 local Cp4 = p4:Clone()
11 Cp2.Parent = chr:WaitForChild("UpperTorso")
12 Cp3.Parent = chr.UpperTorso
13 Cp4.Parent = chr.UpperTorso
14 for i,v in pairs(chr:GetChildren()) do
15 if v:IsA("MeshPart") then
16 Cp1.Parent = v
17 end
18 end
19 end)
20 end)

Hope that works. Good luck with our game.

Ad

Answer this question