!NEED HELP with fire spread through body parts!

  1. What do I want to achieve?
    I want player who touch fire then will spread fires through the body. like if fire touch arm then will spread to whole body

Example: fire touch part from house then will spread to end.

  1. What is the issue?
    wont to spread fire through the body I don’t know why.

  2. What solutions have I tried so far?
    I searched through topics/videos about fire spread but non of these which is for body parts. because of most time they only use on objects(parts like house etc). even I tried these on body part but wont work.

Here a code:

local firePart = script.Parent
local canTouch = true

local function onTouch(otherPart)
	local hum = otherPart.Parent:FindFirstChild("Humanoid")

	if hum and canTouch then
		canTouch = false
		local fire = Instance.new("Fire", otherPart)
		fire.Name = "Fire"
		spawn(function()
			while fire and fire.Parent and hum and hum.Health > 0 do
				hum:TakeDamage(1)
				wait(1)
			end
		end)
		wait(1)
		canTouch = true
	end
end
firePart.Touched:Connect(onTouch)

local Debounce = false

script.Parent.Touched:Connect(function(hit)
	local bodyParts = hit.Parent:GetDescendants()
	if hit:IsA("bodyParts") then
		if not Debounce then 
			Debounce = true
			local fire = Instance.new("Fire")
			local Fire = script.Parent.FireScript:Clone()
			fire.Parent = hit
			wait(0.5)
			Debounce = false
		end
	end
end)

(Reminder, I only a beginner scripter. I used some script from topics and video. so there tons of error or bad script.)

use a for loo. loop through the player character and check if the objects are basepart.

This uses a simple loop to add fire to all the parts while taking damage, since there isn’t enough parts to go through to kill the player entirely the rest of the damage required to kill the player is given in another loop.

local firePart = script.Parent
local canTouch = true
local Debounce = false

local function onTouch(otherPart)
	if Debounce == false then
		Debounce = true
		
		local hum = otherPart.Parent:FindFirstChild("Humanoid")
		
		local character = otherPart.Parent
		
		if hum and canTouch then
			local characterComponents = character:GetChildren()
					
			for _, part in pairs(characterComponents) do
				if part:IsA("MeshPart") or part:IsA("Part") then
					local fire = Instance.new("Fire")
					fire.Parent = part
					
					hum:TakeDamage(1)
					wait(0.5)
				end
			end
			
			repeat
				hum:TakeDamage(1)
				wait(0.5)
			until hum.Health == 0

			wait(1)
		end
		canTouch = true
		Debounce = false
	end
end

firePart.Touched:Connect(onTouch)

*edit - just tried it and it looks epic

1 Like

YES! Thank you!!! u did helps me lots!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.