local s=script.Parent.Parent.Configurations script.Parent.Touched:connect(function(W)if W and(W.Parent and(W.Parent:FindFirstChild("\072\117\109\097\110\111\105\100")and W.Parent.Humanoid.Health>0))then if s.CanKill.Value==true and s.CanCatchFire.Value==true then local c=script.Parent.Parent.FirePart.Fire:Clone()c.Parent=W c.Size=s.FireSize.Value for c=1,s.FireDuration.Value,1 do if W and(W.Parent and(W.Parent:FindFirstChild("\072\117\109\097\110\111\105\100")and W.Parent.Humanoid.Health>0))then W.Parent.Humanoid.Health=W.Parent.Humanoid.Health-1 wait(s.HarmSpeed.Value)end end if c and W then c:Destroy()end elseif s.CanKill.Value==true then W.Parent:BreakJoints()elseif s.CanCatchFire.Value==true then local c=script.Parent.Parent.FirePart.Fire:Clone()c.Parent=W c.Size=s.FireSize.Value wait(s.FireDuration.Value)c:Destroy()end end end)


local configs = script.Parent.Parent.Configurations

script.Parent.Touched:connect(function(hit) -- this is the main function that is called whenever the fire is touched
	if hit and hit.Parent and hit.Parent:FindFirstChild("Humanoid") and hit.Parent.Humanoid.Health > 0 then -- if we have a player or an AI then	
		if configs.CanKill.Value == true and configs.CanCatchFire.Value == true then -- if the fire sets players alight and gives them damamge then
			local fire = script.Parent.Parent.FirePart.Fire:Clone() -- gatting some fire
			fire.Parent = hit -- putting the fire in the part of the person that touched the fire
			fire.Size = configs.FireSize.Value
			for i = 1, configs.FireDuration.Value do -- this deals with giving damamge to the player
				if hit and hit.Parent and hit.Parent:FindFirstChild("Humanoid") and hit.Parent.Humanoid.Health > 0 then
					hit.Parent.Humanoid.Health = hit.Parent.Humanoid.Health - 1 -- reduce health
					wait(configs.HarmSpeed.Value) -- this is the time between giving damamge to the player	
				end
			end
			if fire and hit then -- removing unneeded fire
				fire:Destroy()
			end			
		elseif configs.CanKill.Value == true then -- else if we can only kill
			hit.Parent:BreakJoints() -- kill instantly
		elseif configs.CanCatchFire.Value == true then -- else if we can only set alight
			local fire = script.Parent.Parent.FirePart.Fire:Clone() -- getting some fire
			fire.Parent = hit -- making its parent the part that touched the fire
			fire.Size = configs.FireSize.Value
			wait(configs.FireDuration.Value) -- waiting before removing fire
			fire:Destroy() -- removing fire
		end
	end
end)
