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

how do i make my spreading fire kill players?

i got this script. its a fire and when it touches a part the part burns too. so it spreads, sometime the burning parts explode. but the burning parts deal no damage. any ideas:

function OnTouched(hit)
	if hit == nil then
		return
	end
	if hit.Parent == nil then
		return
	end
	if hit.Anchored == true and hit.Locked == true then
		return end
	if hit.Name == script.Parent.Name then 
		return end

	if hit.Name == "Engine" then 
		return end	

	hit.Anchored = false
	hit.Name = script.Parent.Name
	hit.Color = Color3.new()
	
	fire = Instance.new("Fire")
	fire.Parent = hit
	fire.Heat = 0
	fire.Size = 30

	sound1 = Instance.new("Sound")
	sound1.Parent = hit
	sound1.SoundId = "http://www.roblox.com/asset/?id=31760113"
	sound1.Looped = true
	sound1:Play()


	wait(math.random(5,10))
	script:clone().Parent = hit

	wait(math.random(5,10))

	hit:BreakJoints()

	hit.Color = Color3.new("")

	wait(math.random(5,10))

	e = Instance.new("Explosion")
	e.Parent = game.Workspace
	e.Position = hit.Position

	sound2 = Instance.new("Sound")
	sound2.Parent = hit
	sound2.SoundId = "http://www.roblox.com/asset/?id=16976189"
	sound2.Pitch = 0.75
	sound2:Play()

	hit.Velocity = Vector3.new(0, 100, 0)

	hit.Size = hit.Size/Vector3.new(2,2,2)

	wait(math.random(5,10))
	
	hit:remove()
	
	sound1:Stop()

end

script.Parent.Touched:connect(OnTouched)

1 answer

You can check if the player's character has a descendant that is a "Fire". You can do this by

while true do
	task.wait()
	
	local fireDescendant = character:FindFirstChildWhichIsA("Fire", true) -- looks if the character has the descendant "Fire"

	if fireDescendant ~= nil then
		character.Humanoid:TakeDamage(10)
	end
end

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