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

How do I add Fire and BodyColor Changing to this Script?

I created a Script that kills any Humanoid when they touch the Part but I do not know how to set the Player on Fire and turn all of their BodyColors to the color of Black.

script.Parent.Touched:connect(function(hit)
	if hit and hit.Parent and hit.Parent:FindFirstChild("Humanoid") then
		hit.Parent.Humanoid.Health = 0
	end
end)

2 answers

✓ Accepted answer

You would have to make a variable making the fire, sparkles, or smoke. This is how you would do it.

particles = Instance.("Fire",hit.Parent.Torso)

The full script would be:

script.Parent.Touched:connect(function(hit)
    if hit and hit.Parent and hit.Parent:FindFirstChild("Humanoid") then
        hit.Parent.Humanoid.Health = 0
	particles = Instance.new("Fire",hit.Parent.Torso)
    end
end)

You can replace fire with Sparkles, Smoke, and ParticleEmitter

8 comments

0

What about the BodyColor though?

0

Did not even work. Thank you anyway.

0

What colors?

0

Sir I just edited it try it now

0

It works now

0

Thanks but I still need to change the body color.

0

Okay what colors?

0

Black for all. Also, is it possible to identify Left Arm, Right Arm, Left Leg, and Right Leg in a Script?

(This is in addition to docrobloxman52's answer)

To turn all of the character's parts black, you can iterate over the character's parts:

parts = hit.Parent:GetChildren()
for i = 1, #parts do
	if parts[i]:IsA("BasePart") then
		parts[i].BrickColor = BrickColor.new("Black")
	end
end

(Regarding your comment) If you wish to access a specific part with a space in the name, you can use :FindFirstChild to make sure it's there, or simply use hit.Parent["Left Arm"] (but that will error if Left Arm doesn't exist). So, if you wanted to change their Left Arm to Red, you might do:

local leftArm = hit.Parent:FindFirstChild("Left Arm")
if leftArm then
	leftArm.BrickColor = BrickColor.new("Bright red")
end

2 comments

0

I am only interested in the second Script because it is the only one I understand but I do not know how to add it to the Script.

0

Put it after line 4 in docrobloxman52's script

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