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

Help with lighting body parts on fire?

This is a small portion of a fireball script I'm working on, I want to make it so that on contact, it lights the player on fire(All of their body parts). How would I make it so that the particle emitters position matched that of the body parts.

 fireball.Touched:connect(function(hit)
 local fire = game.Lighting.ParticleEmitter:Clone()
  for i,v in pairs(hit.Parent:GetChildren()) do

Using this script, I tried to make it so that the Particle emitter would be inserted into each thing inside a character. But it did not work. Instead, the particle emitter(s) is/are laying on the baseplate and I have no idea where in the explorer they are located.

In short, the question is how can I position particle emitters to be where I want them to (With most things I use (Object).CFrame = (OtherObject).CFrame)

3 comments

0

I mean I could always just individually put all the particle emitters in the body parts in separate lines of code, but that takes up unnecessary space.

0

Why is the particleemitter in Lighting?

0

I dont really know, just a simple place to store it, where do you think I should put it?

1 answer

###You're on the right track. You're using a for loop to iterate through hit.Parent's children. What's left is to clone the particle emitter. Also, don't use Lighting as storage as we have services like ServerStorage to use as storage. Using Lighting to store things is unsupported by ROBLOX.

local fire = game:GetService("ServerStorage").ParticleEmitter

fireball.Touched:Connect(function(part) -- uppercase C
    for _, v in pairs(part.Parent:GetChildren()) do
        if v:IsA("BasePart") then -- if it's a part
            if not v:FindFirstChild("ParticleEmitter") then -- don't want to spam
                fire:Clone().Parent = v -- clone fire and parent to the part
            end
        end
    end
end)

3 comments

0

There's still a couple things I don't understand, why use "GetService" for ServerStorage? Couldn't you just do game.ServerStorage.ParticleEmitter?

0

Also, whats the difference between a Part and a BasePart?

0

BasePart is the base class for all part objects (Part, Seat, PartOperation, etc.). Those classes inherit from BasePart, so if we use IsA, we can check if the child inherits from the class. In this case we want to check if the child is a part. And I use GetService as game.Service is prone to script error, should the desired service be renamed. GetService returns a service by its ClassName, it creat

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